make race condition less likely to happen. real solution should use a mutex

This commit is contained in:
Hansi, dl9rdz 2019-12-11 10:36:49 +01:00
parent 5459f76a7d
commit 44e0f86382
1 changed files with 2 additions and 1 deletions

View File

@ -427,6 +427,7 @@ void Sonde::receive() {
} }
} else { // RX not ok } else { // RX not ok
if(res==RX_ERROR) flashLed(100); if(res==RX_ERROR) flashLed(100);
Serial.printf("RX result %d, laststate was %d\n", res, si->lastState);
if(si->lastState != 0) { if(si->lastState != 0) {
si->norxStart = millis(); si->norxStart = millis();
si->lastState = 0; si->lastState = 0;
@ -471,8 +472,8 @@ uint16_t Sonde::waitRXcomplete() {
rxloop: rxloop:
while( rxtask.receiveResult==0xFFFF && millis()-t0 < 2000) { delay(50); } while( rxtask.receiveResult==0xFFFF && millis()-t0 < 2000) { delay(50); }
if( rxtask.receiveResult == RX_UPDATERSSI ) { if( rxtask.receiveResult == RX_UPDATERSSI ) {
Serial.print("RSSI update: ");
rxtask.receiveResult = 0xFFFF; rxtask.receiveResult = 0xFFFF;
Serial.print("RSSI update: ");
disp.updateDisplayRSSI(); disp.updateDisplayRSSI();
goto rxloop; goto rxloop;
} }