diff --git a/host/esp32-espnow-recv/platformio.ini b/host/esp32-espnow-recv/platformio.ini index 73a15dd46f3a4a79306f6bb21fa95aa1eda91597..808a5bb1fc8bdb99fa2782ed3898a0cf5dcc7ae5 100644 --- a/host/esp32-espnow-recv/platformio.ini +++ b/host/esp32-espnow-recv/platformio.ini @@ -13,8 +13,8 @@ platform = espressif32 board = esp32-c3-devkitm-1 monitor_speed = 115200 framework = arduino -monitor_port = /dev/ttyUSB1 -upload_port = /dev/ttyUSB1 +; monitor_port = /dev/ttyUSB1 +; upload_port = /dev/ttyUSB1 build_flags = -I include -DCORE_DEBUG_LEVEL=5 diff --git a/host/esp32-espnow-recv/src/main.cpp b/host/esp32-espnow-recv/src/main.cpp index 61baf52196edcda4da788f4d74dfa635c081670e..0a400535d6450f1a28e117c0cd777c57470105c6 100644 --- a/host/esp32-espnow-recv/src/main.cpp +++ b/host/esp32-espnow-recv/src/main.cpp @@ -11,6 +11,8 @@ long time1 = 0; +uint8_t hostMac[] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; + //SoftwareSerial mySerial(RXD2, TXD2); enum MessageType{ @@ -95,6 +97,14 @@ void setup() } Serial.println("ESPNow init success"); + // tell all clients that this is now the host + // can probably be removed after testing + response hello; + hello.type = hostChange; + esp_read_mac(hello.mac, ESP_MAC_WIFI_STA); + hello.time = 0; + esp_now_send(hostMac, (uint8_t*) &hello, sizeof(hello)); + esp_now_register_recv_cb(on_data_recv); // write your initialization code here }