mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-29 10:16:21 +02:00
pendular version
let rx channel change between tx+2 and tx+3
This commit is contained in:
parent
d7ea4bcb89
commit
d8af398208
4 changed files with 21 additions and 14 deletions
|
@ -186,8 +186,8 @@ class Communication : public CommQueue<> {
|
|||
if (p->packet[0] == (TX_REQ_INFO + ALL_FRAMES)) { // response from get information command
|
||||
if(parseFrame(p)) {
|
||||
q->iv->curFrmCnt++;
|
||||
if(!mIsRetransmit && (p->packet[9] == 0x02 || p->packet[9] == 0x82) && p->millis < 85)
|
||||
mHeu.setIvRetriesGood(q->iv,p->millis < 70);
|
||||
if(!mIsRetransmit && (p->packet[9] == 0x02 || p->packet[9] == 0x82) && p->millis < LIMIT_FAST_IV)
|
||||
mHeu.setIvRetriesGood(q->iv,p->millis < LIMIT_VERYFAST_IV);
|
||||
}
|
||||
} else if (p->packet[0] == (TX_REQ_DEVCONTROL + ALL_FRAMES)) { // response from dev control command
|
||||
if(parseDevCtrl(p, q))
|
||||
|
@ -259,7 +259,7 @@ class Communication : public CommQueue<> {
|
|||
if(framnr) {
|
||||
if(0 == q->attempts) {
|
||||
DPRINT_IVID(DBG_INFO, q->iv->id);
|
||||
DBGPRINTLN(F("no attempts left"));
|
||||
DBGPRINTLN(F("timeout, no attempts left"));
|
||||
closeRequest(q, false);
|
||||
return;
|
||||
}
|
||||
|
@ -424,8 +424,8 @@ class Communication : public CommQueue<> {
|
|||
}
|
||||
|
||||
inline bool parseMiFrame(packet_t *p, const queue_s *q) {
|
||||
if(!mIsRetransmit && p->packet[9] == 0x00 && p->millis < 35) //first frame is fast?
|
||||
mHeu.setIvRetriesGood(q->iv,p->millis < 22);
|
||||
if(!mIsRetransmit && p->packet[9] == 0x00 && p->millis < LIMIT_FAST_IV_MI) //first frame is fast?
|
||||
mHeu.setIvRetriesGood(q->iv,p->millis < LIMIT_VERYFAST_IV_MI);
|
||||
if ((p->packet[0] == MI_REQ_CH1 + ALL_FRAMES)
|
||||
|| (p->packet[0] == MI_REQ_CH2 + ALL_FRAMES)
|
||||
|| ((p->packet[0] >= (MI_REQ_4CH + ALL_FRAMES))
|
||||
|
|
|
@ -159,9 +159,9 @@ class Heuristic {
|
|||
|
||||
uint8_t getIvRetries(Inverter<> *iv) {
|
||||
if(iv->heuristics.rxSpeeds[0])
|
||||
return 5;
|
||||
return RETRIES_VERYFAST_IV;
|
||||
if(iv->heuristics.rxSpeeds[1])
|
||||
return 10;
|
||||
return RETRIES_FAST_IV;
|
||||
return 15;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,14 @@ enum {INV_RADIO_TYPE_NRF = 0, INV_RADIO_TYPE_CMT};
|
|||
#define DURATION_PAUSE_LASTFR 45 // how long to pause after last frame (ms)
|
||||
const uint8_t duration_reserve[2] = {115,115};
|
||||
|
||||
#define LIMIT_FAST_IV 85 // time limit to qualify an inverter as very fast answering inverter
|
||||
#define LIMIT_VERYFAST_IV 70 // time limit to qualify an inverter as very fast answering inverter
|
||||
#define LIMIT_FAST_IV_MI 35 // time limit to qualify a MI type inverter as fast answering inverter
|
||||
#define LIMIT_VERYFAST_IV_MI 22 // time limit to qualify a MI type inverter as very fast answering inverter
|
||||
#define RETRIES_FAST_IV 11 // how often shall a message be automatically retransmitted by the nRF (fast answering inverter)
|
||||
#define RETRIES_VERYFAST_IV 7 // how often shall a message be automatically retransmitted by the nRF (very fast answering inverter)
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t fieldId; // field id
|
||||
uint8_t unitId; // uint id
|
||||
|
|
|
@ -124,7 +124,7 @@ class HmRadio : public Radio {
|
|||
|
||||
rxPendular = !rxPendular;
|
||||
//innerLoopTimeout = (rxPendular ? 1 : 2)*DURATION_LISTEN_MIN;
|
||||
innerLoopTimeout = DURATION_LISTEN_MIN;
|
||||
//innerLoopTimeout = DURATION_LISTEN_MIN;
|
||||
|
||||
if(mNRFloopChannels)
|
||||
tempRxChIdx = (tempRxChIdx + 4) % RF_CHANNELS;
|
||||
|
@ -154,7 +154,8 @@ class HmRadio : public Radio {
|
|||
if(tx_ok)
|
||||
mLastIv->mAckCount++;
|
||||
|
||||
mRxChIdx = (mTxChIdx + 2) % RF_CHANNELS;
|
||||
//mRxChIdx = (mTxChIdx + 2) % RF_CHANNELS;
|
||||
mRxChIdx = (mTxChIdx + 3) % RF_CHANNELS;
|
||||
mNrf24->setChannel(mRfChLst[mRxChIdx]);
|
||||
mNrf24->startListening();
|
||||
mTimeslotStart = millis();
|
||||
|
@ -162,7 +163,8 @@ class HmRadio : public Radio {
|
|||
rxPendular = false;
|
||||
mNRFloopChannels = (mLastIv->ivGen == IV_MI);
|
||||
|
||||
innerLoopTimeout = mLastIv->ivGen != IV_MI ? DURATION_TXFRAME : DURATION_ONEFRAME;
|
||||
//innerLoopTimeout = mLastIv->ivGen != IV_MI ? DURATION_TXFRAME : DURATION_ONEFRAME;
|
||||
innerLoopTimeout = DURATION_LISTEN_MIN;
|
||||
}
|
||||
|
||||
if(rx_ready) {
|
||||
|
@ -186,10 +188,7 @@ class HmRadio : public Radio {
|
|||
}
|
||||
rx_ready = false; // reset
|
||||
return mNRFisInRX;
|
||||
} /*else if(tx_fail) {
|
||||
mNRFisInRX = false;
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue