Quasics2019Code/HedyLamarr/src/main/cpp/Commands/AutoLighting.cpp
// Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
void AutoLighting::Execute() {
  auto& driverStation = frc::DriverStation::GetInstance();
  if (!driverStation.IsDSAttached()) {
    #ifdef ENABLE_OLD_ELEVATOR
    transmitMode("no-ds");
    return;
    #endif 
  }
  const auto ds_alliance = driverStation.GetAlliance();
  std::string color = "default";
  switch (ds_alliance) {
    case frc::DriverStation::kRed:
      color = "red";
      break;
    case frc::DriverStation::kBlue:
      color = "blue";
      break;
    case frc::DriverStation::kInvalid:
      color = "demo";
      break;
  }
#ifdef ENABLE_OLD_ELEVATOR
  std::string mode = "default";
  if(elevatorMode == Robot::eBoth){
    mode = "Both";
  }
  else if(elevatorMode == Robot::eElevator){
    mode = "Elevator";
  }
  else if(elevatorMode == Robot::eLifter){
    mode = "Lifter";
  }
  transmitMode(mode);
  #endif 
  transmitColor(color);
}
void AutoLighting :: Execute ( ) { auto & driverStation = frc :: DriverStation :: GetInstance ( ) ; if ( ! driverStation . IsDSAttached ( ) ) { #ifdef ENABLE_OLD_ELEVATOR transmitMode ( " " ) ; return ; #endif } const auto ds_alliance = driverStation . GetAlliance ( ) ; std :: string color = " " ; switch ( ds_alliance ) { case frc :: DriverStation :: kRed : color = " " ; break ; case frc :: DriverStation :: kBlue : color = " " ; break ; case frc :: DriverStation :: kInvalid : color = " " ; break ; } #ifdef ENABLE_OLD_ELEVATOR std :: string mode = " " ; if ( elevatorMode == Robot :: eBoth ) { mode = " " ; } else if ( elevatorMode == Robot :: eElevator ) { mode = " " ; } else if ( elevatorMode == Robot :: eLifter ) { mode = " " ; } transmitMode ( mode ) ; #endif transmitColor ( color ) ; }
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
// Send command to signal that the Driver Station isn't connected (yet). // ENABLE_OLD_ELEVATOR //const auto elevatorMode = Robot::GetLifterMode(); // ENABLE_OLD_ELEVATOR