mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-08 03:57:16 +02:00
Partly fix retransmit errors
* move gotFragment flag
This commit is contained in:
parent
2da9306cf9
commit
08fcbb4e73
3 changed files with 29 additions and 15 deletions
|
@ -252,6 +252,12 @@ class HmRadio : public Radio {
|
|||
p.millis = millis() - mMillis;
|
||||
mNrf24.read(p.packet, p.len);
|
||||
if (p.packet[0] != 0x00) {
|
||||
if(!checkIvSerial(&p.packet[1], mLastIv)) {
|
||||
DPRINT(DBG_WARN, "RX other inverter: ");
|
||||
ah::dumpBuf(p.packet, p.len);
|
||||
return false;
|
||||
}
|
||||
mLastIv->mGotFragment = true;
|
||||
mBufCtrl.push(p);
|
||||
if (p.packet[0] == (TX_REQ_INFO + ALL_FRAMES)) // response from get information command
|
||||
isLastPackage = (p.packet[9] > ALL_FRAMES); // > ALL_FRAMES indicates last packet received
|
||||
|
@ -302,6 +308,16 @@ class HmRadio : public Radio {
|
|||
return iv->ivGen;
|
||||
}
|
||||
|
||||
inline bool checkIvSerial(uint8_t buf[], Inverter<> *iv) {
|
||||
uint8_t tmp[4];
|
||||
CP_U32_BigEndian(tmp, iv->radioId.u64 >> 8);
|
||||
for(uint8_t i = 0; i < 4; i++) {
|
||||
if(tmp[i] != buf[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t DTU_RADIO_ID;
|
||||
uint8_t mRfChLst[RF_CHANNELS] = {03, 23, 40, 61, 75}; // channel List:2403, 2423, 2440, 2461, 2475MHz
|
||||
uint8_t mTxChIdx = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue