implemented Team Button LEDs and tap out feature

This commit is contained in:
2025-04-16 08:11:02 +02:00
parent 70d4b3886d
commit 6c5586e71b
3 changed files with 115 additions and 37 deletions

View File

@@ -48,20 +48,69 @@ void statusLEDs() {
}
}
// usage: blink_LED_BlueTeam(<interval in milliseconds>);
// void blink_LED_BlueTeam(int BLINK_INTERVAL) {
void updateTEAMLEDs() {
if ((buttonREDTEAMvar == true) && (sendToREDTEAMbutton.TEAMLED == false)) {
sendToREDTEAMbutton.TEAMLED = true;
esp_now_send(broadcastAddressREDTEAMbutton, (uint8_t *)&sendToREDTEAMbutton, sizeof(sendToREDTEAMbutton));
}
// else if ((buttonREDTEAMvar == false) && (sendToREDTEAMbutton.TEAMLED == true)) {
// sendToREDTEAMbutton.TEAMLED = false;
// esp_now_send(broadcastAddressREDTEAMbutton, (uint8_t *)&sendToREDTEAMbutton, sizeof(sendToREDTEAMbutton));
// }
if ((buttonBLUETEAMvar == true) && (sendToBLUETEAMbutton.TEAMLED == false)) {
sendToBLUETEAMbutton.TEAMLED = true;
esp_now_send(broadcastAddressBLUETEAMbutton, (uint8_t *)&sendToBLUETEAMbutton, sizeof(sendToBLUETEAMbutton));
}
// else if ((buttonBLUETEAMvar == false) && (sendToBLUETEAMbutton.TEAMLED == true)) {
// sendToBLUETEAMbutton.TEAMLED = false;
// esp_now_send(broadcastAddressBLUETEAMbutton, (uint8_t *)&sendToBLUETEAMbutton, sizeof(sendToBLUETEAMbutton));
// }
}
void REDTEAM_LED(bool STATE) {
if (STATE) {
sendToREDTEAMbutton.TEAMLED = true;
esp_now_send(broadcastAddressREDTEAMbutton, (uint8_t *)&sendToREDTEAMbutton, sizeof(sendToREDTEAMbutton));
} else {
sendToREDTEAMbutton.TEAMLED = false;
esp_now_send(broadcastAddressREDTEAMbutton, (uint8_t *)&sendToREDTEAMbutton, sizeof(sendToREDTEAMbutton));
}
}
void BLUETEAM_LED(bool STATE) {
if (STATE) {
sendToBLUETEAMbutton.TEAMLED = true;
esp_now_send(broadcastAddressBLUETEAMbutton, (uint8_t *)&sendToBLUETEAMbutton, sizeof(sendToBLUETEAMbutton));
} else {
sendToBLUETEAMbutton.TEAMLED = false;
esp_now_send(broadcastAddressBLUETEAMbutton, (uint8_t *)&sendToBLUETEAMbutton, sizeof(sendToBLUETEAMbutton));
}
}
// void blink_LED_BlueTeam() {
// EVERY_N_MILLISECONDS(BLINK_INTERVAL) {
// if (BLINK_COUNTER_BLUETEAM-- > 0) {
// digitalWrite(BLUE_TEAM_LED_PIN, !digitalRead(BLUE_TEAM_LED_PIN));
// if (sendToBLUETEAMbutton.TEAMLED == false) {
// sendToBLUETEAMbutton.TEAMLED = true;
// } else {
// sendToBLUETEAMbutton.TEAMLED = false;
// }
// esp_now_send(broadcastAddressBLUETEAMbutton, (uint8_t *)&sendToBLUETEAMbutton, sizeof(sendToBLUETEAMbutton));
// }
// }
// }
// usage: blink_LED_RedTeam(<interval in milliseconds times two>);
// void blink_LED_RedTeam(int BLINK_INTERVAL) {
// void blink_LED_RedTeam() {
// EVERY_N_MILLISECONDS(BLINK_INTERVAL) {
// if (BLINK_COUNTER_REDTEAM-- > 0) {
// digitalWrite(RED_TEAM_LED_PIN, !digitalRead(RED_TEAM_LED_PIN));
// if (sendToREDTEAMbutton.TEAMLED == false) {
// sendToREDTEAMbutton.TEAMLED = true;
// } else {
// sendToREDTEAMbutton.TEAMLED = false;
// }
// esp_now_send(broadcastAddressREDTEAMbutton, (uint8_t *)&sendToREDTEAMbutton, sizeof(sendToREDTEAMbutton));
// }
// }
// }
// }