diff --git a/esp8266-RM370-interrupt/communication.ino b/esp8266-RM370-interrupt/communication.ino index 3538732..225508f 100644 --- a/esp8266-RM370-interrupt/communication.ino +++ b/esp8266-RM370-interrupt/communication.ino @@ -11,7 +11,11 @@ bool initCommunication() { return true; } +/* + process wifi stack Rx interrupt +*/ ICACHE_RAM_ATTR void processRx(const uint8_t mac[6], const uint8_t* buf, size_t count, void* cbarg) { + //simple frame size check if (count != sizeof(receiveBuffer[rxCounter])) { return; } diff --git a/esp8266-dashboard/communication.ino b/esp8266-dashboard/communication.ino index 3ba2b31..863863b 100644 --- a/esp8266-dashboard/communication.ino +++ b/esp8266-dashboard/communication.ino @@ -30,7 +30,7 @@ ICACHE_RAM_ATTR void processRx(const uint8_t mac[6], const uint8_t* buf, size_t rxCounter = 0; } } - LOG("Message from %02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + LOG("[%02d] Message from %02X:%02X:%02X:%02X:%02X:%02X", rxCounter, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } /* diff --git a/esp8266-dashboard/esp8266-dashboard.ino b/esp8266-dashboard/esp8266-dashboard.ino index afce970..b4ad227 100644 --- a/esp8266-dashboard/esp8266-dashboard.ino +++ b/esp8266-dashboard/esp8266-dashboard.ino @@ -5,28 +5,29 @@ #define globalDelay 20000 const int MAX_PEERS = 20; //Limited due espNOW -const uint8_t key[16] = {0}; +//static const int WIFIESPNOW_KEYLEN = 16; //Limited due espNOW +const uint8_t key[16] = { 0 }; #if defined(ESP8266) #include -#include "Hash.h" +#include #elif defined(ESP32) #include #endif -#include //https://github.com/yoursunny/WifiEspNow +#include //https://github.com/yoursunny/WifiEspNow #include //Ticker Library - -//the sended message over the ether +//version 1.1 - added originMAC typedef struct { char PREAMBLE1 = 'R'; char PREAMBLE2 = 'M'; uint8_t messageID[20]; - char code = 'g'; // [g, y, r] + char code = 'g'; // [g, y, r, X] bool batteryWarning = false; //ToDo not implemented yet uint8_t originMAC[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; } rm370; + rm370 receiveBuffer[MAX_PEERS]; Ticker globalStatusTicker;