|
@ -120,21 +120,23 @@ class HmRadio : public Radio { |
|
|
|
|
|
|
|
|
yield(); |
|
|
yield(); |
|
|
|
|
|
|
|
|
if (millis() - mTimeslotStart < innerLoopTimeout) |
|
|
if ((millis() - mTimeslotStart) < innerLoopTimeout) |
|
|
return; // nothing to do
|
|
|
return; // nothing to do
|
|
|
|
|
|
|
|
|
// otherwise switch to next RX channel
|
|
|
// otherwise switch to next RX channel
|
|
|
mTimeslotStart = millis(); |
|
|
mTimeslotStart = millis(); |
|
|
if(!mNRFloopChannels && (mTimeslotStart - mLastIrqTime > (DURATION_TXFRAME+DURATION_ONEFRAME))) |
|
|
if(!mNRFloopChannels && ((mTimeslotStart - mLastIrqTime) > (DURATION_TXFRAME+DURATION_ONEFRAME))) |
|
|
mNRFloopChannels = true; |
|
|
mNRFloopChannels = true; |
|
|
|
|
|
|
|
|
rxPendular = !rxPendular; |
|
|
rxPendular = !rxPendular; |
|
|
//innerLoopTimeout = (rxPendular ? 1 : 2)*DURATION_LISTEN_MIN;
|
|
|
//innerLoopTimeout = (rxPendular ? 1 : 2)*DURATION_LISTEN_MIN;
|
|
|
innerLoopTimeout = DURATION_LISTEN_MIN; |
|
|
innerLoopTimeout = DURATION_LISTEN_MIN; |
|
|
|
|
|
|
|
|
tempRxChIdx = mNRFloopChannels ? |
|
|
if(mNRFloopChannels) |
|
|
(tempRxChIdx + 4) % RF_CHANNELS : |
|
|
tempRxChIdx = (tempRxChIdx + 4) % RF_CHANNELS |
|
|
(mRxChIdx + rxPendular*4) % RF_CHANNELS; |
|
|
else |
|
|
|
|
|
tempRxChIdx = (mRxChIdx + rxPendular*4) % RF_CHANNELS; |
|
|
|
|
|
|
|
|
mNrf24->setChannel(mRfChLst[tempRxChIdx]); |
|
|
mNrf24->setChannel(mRfChLst[tempRxChIdx]); |
|
|
isRxInit = false; |
|
|
isRxInit = false; |
|
|
|
|
|
|
|
@ -172,7 +174,6 @@ class HmRadio : public Radio { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(rx_ready) { |
|
|
if(rx_ready) { |
|
|
|
|
|
|
|
|
if (getReceived()) { // check what we got, returns true for last package
|
|
|
if (getReceived()) { // check what we got, returns true for last package
|
|
|
mNRFisInRX = false; |
|
|
mNRFisInRX = false; |
|
|
mRadioWaitTime.startTimeMonitor(DURATION_PAUSE_LASTFR); // let the inverter first end his transmissions
|
|
|
mRadioWaitTime.startTimeMonitor(DURATION_PAUSE_LASTFR); // let the inverter first end his transmissions
|
|
@ -188,7 +189,6 @@ class HmRadio : public Radio { |
|
|
mNrf24->setChannel(mRfChLst[tempRxChIdx]); |
|
|
mNrf24->setChannel(mRfChLst[tempRxChIdx]); |
|
|
} else |
|
|
} else |
|
|
mRxChIdx = tempRxChIdx; |
|
|
mRxChIdx = tempRxChIdx; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|