|
|
@ -21,6 +21,7 @@ typedef struct { |
|
|
|
uint8_t len[MAX_PAYLOAD_ENTRIES]; |
|
|
|
bool complete; |
|
|
|
uint8_t maxPackId; |
|
|
|
bool lastFound; |
|
|
|
uint8_t retransmits; |
|
|
|
bool requested; |
|
|
|
} invPayload_t; |
|
|
@ -115,7 +116,7 @@ class Payload : public Handler<payloadListenerType> { |
|
|
|
if ((*pid & 0x7f) > mPayload[iv->id].maxPackId) { |
|
|
|
mPayload[iv->id].maxPackId = (*pid & 0x7f); |
|
|
|
if (*pid > 0x81) |
|
|
|
mLastPacketId = *pid; |
|
|
|
mPayload[iv->id].lastFound = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -162,7 +163,6 @@ class Payload : public Handler<payloadListenerType> { |
|
|
|
|
|
|
|
if ((mPayload[iv->id].txId != (TX_REQ_INFO + ALL_FRAMES)) && (0 != mPayload[iv->id].txId)) { |
|
|
|
// no processing needed if txId is not 0x95
|
|
|
|
// DPRINTLN(DBG_INFO, F("processPayload - set complete, txId: ") + String(mPayload[iv->id].txId, HEX));
|
|
|
|
mPayload[iv->id].complete = true; |
|
|
|
} |
|
|
|
|
|
|
@ -176,24 +176,20 @@ class Payload : public Handler<payloadListenerType> { |
|
|
|
} else { |
|
|
|
if (mPayload[iv->id].retransmits < mMaxRetrans) { |
|
|
|
mPayload[iv->id].retransmits++; |
|
|
|
if (mPayload[iv->id].maxPackId != 0) { |
|
|
|
if(false == mPayload[iv->id].lastFound) { |
|
|
|
DPRINTLN(DBG_WARN, F("while retrieving data: last frame missing: Request Complete Retransmit")); |
|
|
|
mPayload[iv->id].txCmd = iv->getQueuedCmd(); |
|
|
|
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") sendTimePacket")); |
|
|
|
mSys->Radio.sendTimePacket(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex); |
|
|
|
} else if (mPayload[iv->id].maxPackId != 0) { |
|
|
|
for (uint8_t i = 0; i < (mPayload[iv->id].maxPackId - 1); i++) { |
|
|
|
if (mPayload[iv->id].len[i] == 0) { |
|
|
|
DPRINTLN(DBG_WARN, F("while retrieving data: Frame ") + String(i + 1) + F(" missing: Request Retransmit")); |
|
|
|
mSys->Radio.sendCmdPacket(iv->radioId.u64, TX_REQ_INFO, (SINGLE_FRAME + i), true); |
|
|
|
break; // only retransmit one frame per loop
|
|
|
|
break; // only request retransmit one frame per loop
|
|
|
|
} |
|
|
|
yield(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
DPRINTLN(DBG_WARN, F("while retrieving data: last frame missing: Request Retransmit")); |
|
|
|
if (0x00 != mLastPacketId) |
|
|
|
mSys->Radio.sendCmdPacket(iv->radioId.u64, TX_REQ_INFO, mLastPacketId, true); |
|
|
|
else { |
|
|
|
mPayload[iv->id].txCmd = iv->getQueuedCmd(); |
|
|
|
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") sendTimePacket")); |
|
|
|
mSys->Radio.sendTimePacket(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
mSys->Radio.switchRxCh(100); |
|
|
|
} |
|
|
@ -256,6 +252,7 @@ class Payload : public Handler<payloadListenerType> { |
|
|
|
mPayload[iv->id].txCmd = 0; |
|
|
|
mPayload[iv->id].retransmits = 0; |
|
|
|
mPayload[iv->id].maxPackId = 0; |
|
|
|
mPayload[iv->id].lastFound = false; |
|
|
|
mPayload[iv->id].complete = false; |
|
|
|
mPayload[iv->id].requested = false; |
|
|
|
mPayload[iv->id].ts = *mTimestamp; |
|
|
@ -267,7 +264,6 @@ class Payload : public Handler<payloadListenerType> { |
|
|
|
uint8_t mMaxRetrans; |
|
|
|
uint32_t *mTimestamp; |
|
|
|
invPayload_t mPayload[MAX_NUM_INVERTERS]; |
|
|
|
uint8_t mLastPacketId; |
|
|
|
bool mSerialDebug; |
|
|
|
}; |
|
|
|
|
|
|
|