added delay(0)

This commit is contained in:
Timm Bogner 2022-09-09 12:27:58 -05:00
parent 754fb9ce56
commit ccf24f50f9
2 changed files with 16 additions and 9 deletions

View File

@ -20,7 +20,12 @@ void loop() {
loadFDRS(data1, HUMIDITY_T); loadFDRS(data1, HUMIDITY_T);
data2 = readTemp(); data2 = readTemp();
loadFDRS(data2, TEMP_T); loadFDRS(data2, TEMP_T);
sendFDRS(); // DBG(sendFDRS());
if(sendFDRS()){
DBG("Big Success!");
} else {
DBG("Nope, not so much.");
}
sleepFDRS(10); //Sleep time in seconds sleepFDRS(10); //Sleep time in seconds
} }
@ -29,5 +34,5 @@ float readTemp() {
} }
float readHum() { float readHum() {
return random(0,100); return random(0, 100);
} }

View File

@ -121,8 +121,7 @@ void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
esp_now_ack_flag = CRC_OK; esp_now_ack_flag = CRC_OK;
} else { } else {
esp_now_ack_flag = CRC_BAD; esp_now_ack_flag = CRC_BAD;
} }
} }
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) { void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
#endif #endif
@ -408,12 +407,15 @@ bool sendFDRS() {
#ifdef USE_ESPNOW #ifdef USE_ESPNOW
esp_now_send(gatewayAddress, (uint8_t *) &fdrsData, data_count * sizeof(DataReading)); esp_now_send(gatewayAddress, (uint8_t *) &fdrsData, data_count * sizeof(DataReading));
esp_now_ack_flag = CRC_NULL; esp_now_ack_flag = CRC_NULL;
while(esp_now_ack_flag == CRC_NULL){} while(esp_now_ack_flag == CRC_NULL){
if (esp_now_ack_flag = CRC_OK){ delay(0);
return true;
} else {
return false;
} }
if (esp_now_ack_flag == CRC_OK){
return true;
} else {
return false;
}
#endif #endif
#ifdef USE_LORA #ifdef USE_LORA
if(transmitLoRa(&gtwyAddress, fdrsData, data_count)){ if(transmitLoRa(&gtwyAddress, fdrsData, data_count)){