Quasics2016Code/Mettaton/src/Commands/AutomaticLighting.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 AutomaticLighting::Execute() {
	if (DriverStation::GetInstance().IsDisabled()) 
		Robot::lighting->SetColor(Lighting::kRainbow);
	else if (!DriverStation::GetInstance().IsFMSAttached()) 
		Robot::lighting->SetColor(Lighting::kGreen);
	else if (DriverStation::GetInstance().GetAlliance() 
			== DriverStation::GetInstance().kRed)
		Robot::lighting->SetColor(Lighting::kRed);
	else if (DriverStation::GetInstance().GetAlliance() 
			== DriverStation::GetInstance().kBlue)
		Robot::lighting->SetColor(Lighting::kBlue);
	else
		Robot::lighting->SetColor(Lighting::kWhite); 
	if (DriverStation::GetInstance().IsDisabled()) 
		Robot::lighting->SetDynamic(Lighting::kOn);
	else if (DriverStation::GetInstance().IsEnabled() 
			&& DriverStation::GetInstance().IsAutonomous())
		Robot::lighting->SetDynamic(Lighting::kBlinking);
	else if (DriverStation::GetInstance().IsEnabled() 
			&& DriverStation::GetInstance().IsOperatorControl())
		Robot::lighting->SetDynamic(Lighting::kBreathing);
	else 
		Robot::lighting->SetDynamic(Lighting::kOn);
}
void AutomaticLighting :: Execute ( ) { if ( DriverStation :: GetInstance ( ) . IsDisabled ( ) ) Robot :: lighting -> SetColor ( Lighting :: kRainbow ) ; else if ( ! DriverStation :: GetInstance ( ) . IsFMSAttached ( ) ) Robot :: lighting -> SetColor ( Lighting :: kGreen ) ; else if ( DriverStation :: GetInstance ( ) . GetAlliance ( ) == DriverStation :: GetInstance ( ) . kRed ) Robot :: lighting -> SetColor ( Lighting :: kRed ) ; else if ( DriverStation :: GetInstance ( ) . GetAlliance ( ) == DriverStation :: GetInstance ( ) . kBlue ) Robot :: lighting -> SetColor ( Lighting :: kBlue ) ; else Robot :: lighting -> SetColor ( Lighting :: kWhite ) ; if ( DriverStation :: GetInstance ( ) . IsDisabled ( ) ) Robot :: lighting -> SetDynamic ( Lighting :: kOn ) ; else if ( DriverStation :: GetInstance ( ) . IsEnabled ( ) && DriverStation :: GetInstance ( ) . IsAutonomous ( ) ) Robot :: lighting -> SetDynamic ( Lighting :: kBlinking ) ; else if ( DriverStation :: GetInstance ( ) . IsEnabled ( ) && DriverStation :: GetInstance ( ) . IsOperatorControl ( ) ) Robot :: lighting -> SetDynamic ( Lighting :: kBreathing ) ; else Robot :: lighting -> SetDynamic ( Lighting :: kOn ) ; }
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
//Set Lights to Rainbow color //Else: Set Lights to Green if no FMS //Else: Set Lights to red if FMS and on red team //Else: Set lights to blue if FMS and on blue team //Else: Set lights to White //Set lights to Full On if Disabled //Else: Set lights to Blink if Enabled in Autonomous //Else: Set lights to Breathe/Pulse if Enabled in Teleop //Else: Set lights to Full On