mRxChIdx=mRxChannels-2;// ensure, we start receiving with first relative channel....
//mRxChIdx = mRxChannels - 2; // ensure, we start receiving with first relative channel....
if(!mLastIv->mGotFragment)
mRxChIdx=mLastIv->mRxChanIdx;//(mLastIv->mRxChanIdx + RF_MAX_CHANNEL_ID -1) % RF_MAX_CHANNEL_ID; // make sure, we start with last successfull channel (result will be increased in loop)
//mRxChannels - 1; //
//(mTxChIdx + mRxChannels) % RF_MAX_CHANNEL_ID; // start with a fixed offset
while((millis()-loopMillis)<mRxTmoOuterLoop){
@ -130,28 +132,31 @@ class HmRadio : public Radio {
mIrqRcvd=false;
if(getReceived()){// everything received
mLastIv->mRxChanIdx=mRxChIdx;
return;
}
}
yield();
}
// switch to next RX channel
/*if(++mRxChIdx >= RF_CHANNELS)
mRxChIdx=0;*/
if(++mRxChIdx>=RF_CHANNELS)
mRxChIdx=0;
//if(++mRxChIdx >= mLastIv->mRxChannels)
if(++mRxChIdx>=mRxChannels)
mRxChIdx=0;
/*if(++mRxChIdx >= mRxChannels)
mRxChIdx=0;*/
uint8_tnextRxCh=(mRxChIdx+mTxChIdx+4)%RF_MAX_CHANNEL_ID;// let 3 channels in shifting out; might cause problems for tx channel 75, see Oberfritze remark to his array
//uint8_t nextRxCh = (mRxChIdx + mTxChIdx + mRxChannels-1) % RF_MAX_CHANNEL_ID; // shift rx channel relative to tx channel; might cause problems for tx channel 75, see Oberfritze remark to his array
//mNrf24->setChannel(mRfChLst[mRxChIdx]);
mNrf24->setChannel(mRfChLst[nextRxCh]);
mNrf24->setChannel(mRfChLst[mRxChIdx]);
//mNrf24->setChannel(mRfChLst[nextRxCh]);
startMicros=micros();
}
// not finished but time is over
//if(++mRxChIdx >= RF_CHANNELS)
// mRxChIdx = 0;
if(!mLastIv->mGotFragment)
mLastIv->mRxChanIdx=mRxChIdx;
return;
}
@ -249,33 +254,33 @@ class HmRadio : public Radio {