added forced start/continue, combined remote firmware

This commit is contained in:
2025-02-26 06:03:32 +01:00
parent c2bffd7a26
commit 20fe660838
3 changed files with 86 additions and 49 deletions

View File

@@ -6,16 +6,22 @@
#include <avdweb_Switch.h> // https://github.com/avdwebLibraries/avdweb_Switch
// Hardware connections
#define START_BTN_PIN 4
#define PAUSE_BTN_PIN 3
#define PIT_BTN_PIN 2
#define RESET_BTN_PIN 1
#define START_BTN_PIN 1
#define PAUSE_BTN_PIN 2
#define PIT_BTN_PIN 3
#define RESET_BTN_PIN 4
#define REDTEAM_BTN_PIN 5
#define BLUETEAM_BTN_PIN 6
#define REDTEAM_LED_PIN 39
#define BLUETEAM_LED_PIN 40
// define buttons and switches
Switch buttonSTART = Switch(START_BTN_PIN);
Switch buttonSTART = Switch(START_BTN_PIN, INPUT_PULLUP, LOW, 50, 1000);
Switch buttonPAUSE = Switch(PAUSE_BTN_PIN);
Switch buttonPIT = Switch(PIT_BTN_PIN);
Switch buttonRESET = Switch(RESET_BTN_PIN);
Switch buttonPIT = Switch(PIT_BTN_PIN, INPUT_PULLUP, LOW, 50, 1000);
Switch buttonRESET = Switch(RESET_BTN_PIN, INPUT_PULLUP, LOW, 50, 1000);
Switch buttonREDTEAM = Switch(REDTEAM_BTN_PIN, INPUT_PULLUP, LOW, 50, 1000);
Switch buttonBLUETEAM = Switch(BLUETEAM_BTN_PIN, INPUT_PULLUP, LOW, 50, 1000);
bool buttonSTARTvar = false;
bool buttonPAUSEvar = false;
@@ -31,25 +37,30 @@ uint8_t broadcastAddress[] = {0x84, 0xFC, 0xE6, 0xC7, 0x1A, 0x8C};
// Structure example to send data
// Must match the receiver structure
typedef struct struct_message {
bool buttonSTARTremote;
bool buttonPAUSEremote;
bool buttonPITremote;
bool buttonRESETremote;
} struct_message;
typedef struct struct_message_send {
int boardID;
bool buttonSTART;
bool buttonSTARTforced;
bool buttonPAUSE;
bool buttonPIT;
bool buttonPIThold;
bool buttonRESET;
bool buttonREDTEAM;
bool buttonREDTEAMtapout;
bool buttonBLUETEAM;
bool buttonBLUETEAMtapout;
} struct_message_send;
// Create a struct_message called myData
struct_message remoteDATA;
struct_message_send sendDATA;
esp_now_peer_info_t peerInfo;
// callback when data is sent
/*
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
Serial.print("\r\nLast Packet Send Status:\t");
Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");
}
*/
void setup() {
Serial.begin(115200);