mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-08 13:10:29 +00:00
Small fixes for timekeeping PR
This commit is contained in:
parent
745aedcec7
commit
8d21ff7d72
@ -50,8 +50,6 @@ uint8_t newCmd = cmd_clear;
|
||||
DataReading fdrsData[256]; // buffer for loadFDRS()
|
||||
uint8_t data_count = 0;
|
||||
|
||||
TimeSource timeSource;
|
||||
|
||||
// Function Prototypes needed due to #ifdefs being moved outside of function definitions in header files
|
||||
void broadcastLoRa();
|
||||
void sendLoRaNbr(uint8_t);
|
||||
|
@ -58,7 +58,7 @@
|
||||
#error "Ethernet only supported for ESP32."
|
||||
#endif
|
||||
|
||||
#if defined(USE_OLED) && (!defined(ESP32) || !defined(ESP8266))
|
||||
#if defined(USE_OLED) && (!defined(ESP32) && !defined(ESP8266))
|
||||
#warning "OLED current supported for only ESP32 or ESP8266."
|
||||
#undef USE_OLED
|
||||
#endif
|
||||
|
@ -604,8 +604,8 @@ crcResult receiveLoRa()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG2("Incoming LoRa packet of " + String(packetSize) + " bytes received from address 0x" + String(sourceMAC, HEX) + " destined for node address 0x" + String(destMAC, HEX));
|
||||
{ // Uncommenting below will print out packets from other LoRa controllers being sent.
|
||||
// DBG2("Incoming LoRa packet of " + String(packetSize) + " bytes received from address 0x" + String(sourceMAC, HEX) + " destined for node address 0x" + String(destMAC, HEX));
|
||||
// printLoraPacket(packet,sizeof(packet));
|
||||
return CRC_NULL;
|
||||
}
|
||||
@ -815,7 +815,7 @@ void handleLoRa()
|
||||
if(TDIFF(lastTxtime,(TXDELAYMS + random(0,50)))) {
|
||||
// Start Transmit data from the SystemPacket queue
|
||||
if(!ISBUFFEMPTY(spBuff) && (loraTxState == stReady)) {
|
||||
DBG2("SP Index: start: " + String(spBuff.startIdx) + " end: " + String(spBuff.endIdx) + " Address: 0x" + String(address,HEX) + " Cmd: " + String(spBuff.sp->cmd));
|
||||
DBG2("SP Index: start: " + String(spBuff.startIdx) + " end: " + String(spBuff.endIdx) + " Address: 0x" + String(*(spBuff.address + spBuff.startIdx),HEX) + " Cmd: " + String(spBuff.sp->cmd));
|
||||
// Lora ping request stuff here
|
||||
if((spBuff.sp + spBuff.startIdx)->cmd == cmd_ping && (spBuff.sp + spBuff.startIdx)->param == ping_request) {
|
||||
loraPing.status = stInProcess;
|
||||
|
@ -35,9 +35,11 @@ bool reqTimeEspNow() {
|
||||
SystemPacket sys_packet = {.cmd = cmd_time, .param = 0};
|
||||
DBG1("Requesting time from gateway 0x" + String(gatewayAddress[5],HEX));
|
||||
esp_now_send(gatewayAddress, (uint8_t *)&sys_packet, sizeof(SystemPacket));
|
||||
while(timeSource.tmNetIf < TMIF_ESPNOW && (millis() - pingStart < 1000)) {
|
||||
while(timeSource.tmNetIf < TMIF_ESPNOW && (millis() - pingStart < 300)) {
|
||||
// wait for time to be set
|
||||
// magic happens here :)
|
||||
yield();
|
||||
delay(0);
|
||||
}
|
||||
if(timeSource.tmNetIf == TMIF_ESPNOW) {
|
||||
return true;
|
||||
|
@ -14,8 +14,7 @@
|
||||
#define FDRS_TIME_SEND_INTERVAL TIME_SEND_INTERVAL
|
||||
#else
|
||||
#define FDRS_TIME_SEND_INTERVAL GLOBAL_TIME_SEND_INTERVAL
|
||||
#endif // TIME_PRINTTIME
|
||||
|
||||
#endif // TIME_SEND_INTERVAL
|
||||
|
||||
// select Time, in minutes, between time printed configuration
|
||||
#if defined(TIME_PRINTTIME)
|
||||
|
Loading…
Reference in New Issue
Block a user