minor details

This commit is contained in:
coelner 2021-06-22 21:41:10 +02:00
parent 7c4adc0267
commit 20ae2ef677
3 changed files with 12 additions and 7 deletions

View File

@ -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;
}

View File

@ -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]);
}
/*

View File

@ -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 <ESP8266WiFi.h>
#include "Hash.h"
#include <Hash.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif
#include <WifiEspNowBroadcast.h> //https://github.com/yoursunny/WifiEspNow
#include <WifiEspNowBroadcast.h> //https://github.com/yoursunny/WifiEspNow
#include <Ticker.h> //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;