yield();// do I need to yield or does it automatically?
if(pingFlag)
{
DBG("ESP-NOW Ping Reply in "+String(millis()-ping_start)+"ms from "+String(address[0],HEX)+":"+String(address[1],HEX)+":"+String(address[2],HEX)+":"+String(address[3],HEX)+":"+String(address[4],HEX)+":"+String(address[5],HEX));
return(millis()-ping_start);
}
}
DBG("No ESP-NOW ping returned within "+String(timeout)+"ms.");
{// Check if addressed to this device or broadcast
// printLoraPacket(packet,sizeof(packet));
@ -381,7 +404,7 @@ crcResult getLoRa()
{// We have received a ping request or reply??
if(receiveData[0].param==1)
{// This is a reply to our ping request
is_ping =true;
pingFlag =true;
DBG("We have received a ping reply via LoRa from address "+String(sourceMAC,HEX));
}
elseif(receiveData[0].param==0)
@ -410,7 +433,7 @@ crcResult getLoRa()
{// We have received a ping request or reply??
if(receiveData[0].param==1)
{// This is a reply to our ping request
is_ping =true;
pingFlag =true;
DBG("We have received a ping reply via LoRa from address "+String(sourceMAC,HEX));
}
elseif(receiveData[0].param==0)
@ -437,8 +460,8 @@ crcResult getLoRa()
}
else
{
// DBG("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));
DBG("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));
returnCRC_NULL;
}
}
@ -453,9 +476,39 @@ crcResult getLoRa()
returnCRC_NULL;
}
}
#endif // USE_LORA
returnCRC_NULL;
#endif // USE_LORA
}
// FDRS Sensor pings gateway and listens for a defined amount of time for a reply
// Blocking function for timeout amount of time (up to timeout time waiting for reply)(IE no callback)
// Returns the amount of time in ms that the ping takes or predefined value if ping fails within timeout