mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-08 13:10:29 +00:00
added delay(0)
This commit is contained in:
parent
754fb9ce56
commit
ccf24f50f9
@ -20,7 +20,12 @@ void loop() {
|
||||
loadFDRS(data1, HUMIDITY_T);
|
||||
data2 = readTemp();
|
||||
loadFDRS(data2, TEMP_T);
|
||||
sendFDRS();
|
||||
// DBG(sendFDRS());
|
||||
if(sendFDRS()){
|
||||
DBG("Big Success!");
|
||||
} else {
|
||||
DBG("Nope, not so much.");
|
||||
}
|
||||
sleepFDRS(10); //Sleep time in seconds
|
||||
}
|
||||
|
||||
@ -29,5 +34,5 @@ float readTemp() {
|
||||
}
|
||||
|
||||
float readHum() {
|
||||
return random(0,100);
|
||||
return random(0, 100);
|
||||
}
|
||||
|
@ -121,8 +121,7 @@ void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
|
||||
esp_now_ack_flag = CRC_OK;
|
||||
} else {
|
||||
esp_now_ack_flag = CRC_BAD;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
|
||||
#endif
|
||||
@ -408,12 +407,15 @@ bool sendFDRS() {
|
||||
#ifdef USE_ESPNOW
|
||||
esp_now_send(gatewayAddress, (uint8_t *) &fdrsData, data_count * sizeof(DataReading));
|
||||
esp_now_ack_flag = CRC_NULL;
|
||||
while(esp_now_ack_flag == CRC_NULL){}
|
||||
if (esp_now_ack_flag = CRC_OK){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
while(esp_now_ack_flag == CRC_NULL){
|
||||
delay(0);
|
||||
}
|
||||
if (esp_now_ack_flag == CRC_OK){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef USE_LORA
|
||||
if(transmitLoRa(>wyAddress, fdrsData, data_count)){
|
||||
|
Loading…
Reference in New Issue
Block a user