added preprocessor statements to switch out MAC Addresses at compile time

This commit is contained in:
2025-09-23 07:10:36 +02:00
parent c450cfb7c9
commit 4d7a43c9d1
2 changed files with 43 additions and 20 deletions

View File

@@ -8,6 +8,11 @@
#include <CountDown.h> // https://github.com/RobTillaart/CountDown
#include <StopWatch.h> // https://github.com/RobTillaart/StopWatch_RT
// set Arena, switches the MAC addresses out
// 1 = Arena A (Ant)
// 2 = Arena B (Beetle)
#define ARENA 1
// Hardware connections
// Buttons:
#define START_BTN_PIN 1
@@ -84,12 +89,16 @@ bool resumeFight = false;
//------------------------------------------------------------------------------------
// ESP-NOW config
// send config, Clock:
// A Arena
uint8_t broadcastAddressClock1[] = {0x48, 0x27, 0xE2, 0x5D, 0xB6, 0x84};
uint8_t broadcastAddressClock2[] = {0xD8, 0x3B, 0xDA, 0xC9, 0x49, 0xC6};
// B Arena
//uint8_t broadcastAddressClock1[] = {0xD8, 0x3B, 0xDA, 0xC9, 0x49, 0xC6};
//uint8_t broadcastAddressClock2[] = {0xD8, 0x3B, 0xDA, 0xC8, 0xFF, 0xFA};
#if ARENA == 1
// A Arena
uint8_t broadcastAddressClock1[] = {0x48, 0x27, 0xE2, 0x5D, 0xB6, 0x84};
uint8_t broadcastAddressClock2[] = {0xD8, 0x3B, 0xDA, 0xC9, 0x49, 0xC6};
#elif ARENA == 2
// B Arena
uint8_t broadcastAddressClock1[] = {0xD8, 0x3B, 0xDA, 0xC9, 0x49, 0xC6};
uint8_t broadcastAddressClock2[] = {0xD8, 0x3B, 0xDA, 0xC8, 0xFF, 0xFA};
#endif
// struct for clock data
typedef struct struct_message_Clock {
int sendMinutes;
@@ -104,12 +113,15 @@ typedef struct struct_message_Clock {
struct_message_Clock sendClockDATA;
// send config, pilot buttons:
// A Arena
uint8_t broadcastAddressREDTEAMbutton[] = {0x84, 0xFC, 0xE6, 0xC7, 0x23, 0x14};
uint8_t broadcastAddressBLUETEAMbutton[] = {0x84, 0xFC, 0xE6, 0xC7, 0x1A, 0x02};
// B Arena
//uint8_t broadcastAddressREDTEAMbutton[] = {0xD8, 0x3B, 0xDA, 0xC8, 0x95, 0x58};
//uint8_t broadcastAddressBLUETEAMbutton[] = {0xD8, 0x3B, 0xDA, 0xC8, 0x95, 0x1C};
#if ARENA == 1
// A Arena
uint8_t broadcastAddressREDTEAMbutton[] = {0x84, 0xFC, 0xE6, 0xC7, 0x23, 0x14};
uint8_t broadcastAddressBLUETEAMbutton[] = {0x84, 0xFC, 0xE6, 0xC7, 0x1A, 0x02};
#elif ARENA == 2
// B Arena
uint8_t broadcastAddressREDTEAMbutton[] = {0xD8, 0x3B, 0xDA, 0xC8, 0x95, 0x58};
uint8_t broadcastAddressBLUETEAMbutton[] = {0xD8, 0x3B, 0xDA, 0xC8, 0x95, 0x1C};
#endif
// Structure for sending data
typedef struct struct_message_send {
@@ -121,10 +133,13 @@ struct_message_send sendToREDTEAMbutton;
struct_message_send sendToBLUETEAMbutton;
// ESP-Now stuff for the Pit controller
// A Arena
uint8_t broadcastAddressPitController[] = {0x84, 0xFC, 0xE6, 0xC7, 0x19, 0xDE};
// B Arena
//uint8_t broadcastAddressPitController[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xB0, 0x0B};
#if ARENA == 1
// A Arena
uint8_t broadcastAddressPitController[] = {0x84, 0xFC, 0xE6, 0xC7, 0x19, 0xDE};
#elif ARENA == 2
// B Arena
uint8_t broadcastAddressPitController[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xB0, 0x0B};
#endif
// Test Pit controller
//uint8_t broadcastAddressPitController[] = {0x94, 0xA9, 0x90, 0x0B, 0x21, 0x64};