refactored LED Display logic to make it more readable
This commit is contained in:
@@ -417,20 +417,33 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
// update the LED Display
|
||||
if (!(buttonREDTEAMtapout || buttonBLUETEAMtapout)) {
|
||||
// If either team has tapped out, skip updating the display.
|
||||
if (buttonREDTEAMtapout || buttonBLUETEAMtapout) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Display the Ready CountDown timer if it is running.
|
||||
if (ReadyCountDown.isRunning()) {
|
||||
sendTimeDisplay((ReadyCountDown.remaining()/60%60), (ReadyCountDown.remaining()%60), 255, 165, 0, CLOCK_LED_BRIGHTNESS);
|
||||
return;
|
||||
}
|
||||
|
||||
// When the RUMBLE switch is active, always show the rumble timer.
|
||||
if (switchRUMBLE.on()) {
|
||||
sendTimeDisplay((rumbleTIME.elapsed()/60%60), (rumbleTIME.elapsed()%60), 0, 255, 255, CLOCK_LED_BRIGHTNESS);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the fight countdown isn't running and isn't paused, determine which countdown color to use.
|
||||
if (!FightCountDown.isRunning() && !countdownPAUSED) {
|
||||
// Choose green if both buttons are active; otherwise, choose magenta.
|
||||
if (buttonREDTEAMvar && buttonBLUETEAMvar) {
|
||||
sendTimeDisplay((countdownTIME/60%60), (countdownTIME%60), 0, 255, 0, CLOCK_LED_BRIGHTNESS);
|
||||
} else {
|
||||
if (!switchRUMBLE.on()) {
|
||||
if (!FightCountDown.isRunning() && countdownPAUSED == false) {
|
||||
sendTimeDisplay((countdownTIME/60%60), (countdownTIME%60), 0, XDAS, 0, CLOCK_LED_BRIGHTNESS);
|
||||
sendTimeDisplay((countdownTIME/60%60), (countdownTIME%60), 255, 0, 255, CLOCK_LED_BRIGHTNESS);
|
||||
}
|
||||
} else {
|
||||
// Otherwise, show the fight countdown timer.
|
||||
sendTimeDisplay((FightCountDown.remaining()/60%60), (FightCountDown.remaining()%60), 0, 255, 0, CLOCK_LED_BRIGHTNESS);
|
||||
}
|
||||
} else if (switchRUMBLE.on()) {
|
||||
sendTimeDisplay((rumbleTIME.elapsed()/60%60), (rumbleTIME.elapsed()%60), 0, 255, 255, CLOCK_LED_BRIGHTNESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user