Fix Arduino compile issues

pull/139/head
Jeff Lehman 1 year ago
parent 209eb396a7
commit 8410f398e2

@ -84,6 +84,7 @@ RADIOLIB_MODULE radio = new Module(LORA_SS, LORA_DIO, LORA_RST, -1, LORA_SPI);
RADIOLIB_MODULE radio = new Module(LORA_SS, LORA_DIO, LORA_RST, -1);
#endif // CUSTOM_SPI
bool pingFlag = false;
bool transmitFlag = false; // flag to indicate transmission or reception state
volatile bool enableInterrupt = true; // disable interrupt when it's not needed
volatile bool operationDone = false; // flag to indicate that a packet was sent or received

@ -51,6 +51,7 @@ uint8_t ln;
bool newData;
uint8_t gatewayAddress[] = {MAC_PREFIX, GTWY_MAC};
const uint16_t espnow_size = 250 / sizeof(DataReading);
crcResult crcReturned = CRC_NULL;
uint32_t gtwy_timeout = 0;
uint8_t incMAC[6];
@ -355,7 +356,7 @@ bool addFDRS(int timeout, void (*new_cb_ptr)(DataReading))
return true;
}
uint32_t pingFDRS(uint32 timeout)
uint32_t pingFDRS(uint32_t timeout)
{
#ifdef USE_ESPNOW
uint32_t pingResponseMs = pingFDRSEspNow(gatewayAddress, timeout);

@ -10,9 +10,11 @@
uint8_t broadcast_mac[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
crcResult esp_now_ack_flag;
bool is_added = false;
bool pingFlag = false;
#ifdef USE_ESPNOW
bool pingFlag = false;
// Set ESP-NOW send and receive callbacks for either ESP8266 or ESP32
#if defined(ESP8266)
void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus)
@ -69,10 +71,10 @@ void OnDataRecv(const uint8_t *mac, const uint8_t *incomingData, int len)
// FDRS node 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
uint32_t pingFDRSEspNow(uint16_t *address, uint32_t timeout) {
uint32_t pingFDRSEspNow(uint8_t *address, uint32_t timeout) {
SystemPacket sys_packet = {.cmd = cmd_ping, .param = 0};
esp_now_send(gatewayAddress, (uint8_t *)&sys_packet, sizeof(SystemPacket));
esp_now_send(address, (uint8_t *)&sys_packet, sizeof(SystemPacket));
DBG(" ESP-NOW ping sent.");
uint32_t ping_start = millis();
pingFlag = false;

@ -485,6 +485,7 @@ crcResult getLoRa()
// Returns the amount of time in ms that the ping takes or predefined value if ping fails within timeout
uint32_t pingFDRSLoRa(uint16_t *address, uint32_t timeout)
{
#ifdef USE_LORA
SystemPacket sys_packet = {.cmd = cmd_ping, .param = 0};
transmitLoRa(address, &sys_packet, 1);
@ -504,6 +505,7 @@ uint32_t pingFDRSLoRa(uint16_t *address, uint32_t timeout)
}
DBG("No LoRa ping returned within " + String(timeout) + "ms.");
return UINT32_MAX;
#endif // USE_LORA
}

Loading…
Cancel
Save