minor details
This commit is contained in:
parent
7c4adc0267
commit
20ae2ef677
@ -11,7 +11,11 @@ bool initCommunication() {
|
|||||||
return true;
|
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) {
|
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])) {
|
if (count != sizeof(receiveBuffer[rxCounter])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ ICACHE_RAM_ATTR void processRx(const uint8_t mac[6], const uint8_t* buf, size_t
|
|||||||
rxCounter = 0;
|
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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5,28 +5,29 @@
|
|||||||
|
|
||||||
#define globalDelay 20000
|
#define globalDelay 20000
|
||||||
const int MAX_PEERS = 20; //Limited due espNOW
|
const int MAX_PEERS = 20; //Limited due espNOW
|
||||||
|
//static const int WIFIESPNOW_KEYLEN = 16; //Limited due espNOW
|
||||||
const uint8_t key[16] = { 0 };
|
const uint8_t key[16] = { 0 };
|
||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include "Hash.h"
|
#include <Hash.h>
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
#include <WifiEspNowBroadcast.h> //https://github.com/yoursunny/WifiEspNow
|
#include <WifiEspNowBroadcast.h> //https://github.com/yoursunny/WifiEspNow
|
||||||
#include <Ticker.h> //Ticker Library
|
#include <Ticker.h> //Ticker Library
|
||||||
|
|
||||||
|
//version 1.1 - added originMAC
|
||||||
//the sended message over the ether
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char PREAMBLE1 = 'R';
|
char PREAMBLE1 = 'R';
|
||||||
char PREAMBLE2 = 'M';
|
char PREAMBLE2 = 'M';
|
||||||
uint8_t messageID[20];
|
uint8_t messageID[20];
|
||||||
char code = 'g'; // [g, y, r]
|
char code = 'g'; // [g, y, r, X]
|
||||||
bool batteryWarning = false; //ToDo not implemented yet
|
bool batteryWarning = false; //ToDo not implemented yet
|
||||||
uint8_t originMAC[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
uint8_t originMAC[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
} rm370;
|
} rm370;
|
||||||
|
|
||||||
|
|
||||||
rm370 receiveBuffer[MAX_PEERS];
|
rm370 receiveBuffer[MAX_PEERS];
|
||||||
|
|
||||||
Ticker globalStatusTicker;
|
Ticker globalStatusTicker;
|
||||||
|
Loading…
Reference in New Issue
Block a user