117 lines
3.6 KiB
C++
117 lines
3.6 KiB
C++
void checkPIT() {
|
|
if ((digitalRead(!PIT_RELEASE_PIN)) && (millis() - PITopenTimestamp >= PITopenTime)) {
|
|
digitalWrite(PIT_RELEASE_PIN, relayOffState);
|
|
}
|
|
}
|
|
|
|
void openPIT() {
|
|
if (!PITreleased) {
|
|
PITreleased = true;
|
|
PITopenTimestamp = millis();
|
|
digitalWrite(PIT_RELEASE_PIN, relayOnState);
|
|
}
|
|
}
|
|
|
|
void openPITmanually() {
|
|
PITreleased = true;
|
|
PITopenTimestamp = millis();
|
|
digitalWrite(PIT_RELEASE_PIN, relayOnState);
|
|
}
|
|
|
|
void arenaLIGHT() {
|
|
if (switchLIGHT.on()) {
|
|
digitalWrite(LIGHT_PIN, LOW);
|
|
}
|
|
else {
|
|
digitalWrite(LIGHT_PIN, HIGH);
|
|
}
|
|
}
|
|
|
|
void statusLEDs() {
|
|
if (!switchLIGHT.on()) {
|
|
digitalWrite(LIGHT_STATUS_LED, HIGH);
|
|
}
|
|
else {
|
|
digitalWrite(LIGHT_STATUS_LED, LOW);
|
|
}
|
|
if (switchPIT.on()) {
|
|
digitalWrite(AUTOPIT_STATUS_LED, HIGH);
|
|
}
|
|
else {
|
|
digitalWrite(AUTOPIT_STATUS_LED, LOW);
|
|
}
|
|
if (switchRUMBLE.on()) {
|
|
digitalWrite(MODE_STATUS_LED, HIGH);
|
|
}
|
|
else {
|
|
digitalWrite(MODE_STATUS_LED, LOW);
|
|
}
|
|
}
|
|
|
|
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) {
|
|
// if (sendToBLUETEAMbutton.TEAMLED == false) {
|
|
// sendToBLUETEAMbutton.TEAMLED = true;
|
|
// } else {
|
|
// sendToBLUETEAMbutton.TEAMLED = false;
|
|
// }
|
|
// esp_now_send(broadcastAddressBLUETEAMbutton, (uint8_t *)&sendToBLUETEAMbutton, sizeof(sendToBLUETEAMbutton));
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
|
|
// void blink_LED_RedTeam() {
|
|
// EVERY_N_MILLISECONDS(BLINK_INTERVAL) {
|
|
// if (BLINK_COUNTER_REDTEAM-- > 0) {
|
|
// if (sendToREDTEAMbutton.TEAMLED == false) {
|
|
// sendToREDTEAMbutton.TEAMLED = true;
|
|
// } else {
|
|
// sendToREDTEAMbutton.TEAMLED = false;
|
|
// }
|
|
// esp_now_send(broadcastAddressREDTEAMbutton, (uint8_t *)&sendToREDTEAMbutton, sizeof(sendToREDTEAMbutton));
|
|
// }
|
|
// }
|
|
// }
|