Browse Source

MI - add some multiframe handling

pull/778/head
rejoe2 2 years ago
committed by GitHub
parent
commit
12f37c2cb0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/hm/hmRadio.h
  2. 9
      src/hm/miPayload.h

5
src/hm/hmRadio.h

@ -253,7 +253,10 @@ class HmRadio {
mBufCtrl.push(p);
if (p.packet[0] == (TX_REQ_INFO + ALL_FRAMES)) // response from get information command
isLastPackage = (p.packet[9] > 0x81); // > 0x81 indicates last packet received
else if (p.packet[0] != 0x00) // ignore fragment number zero
else if (p.packet[0] == ( 0x0f + ALL_FRAMES) ) // response from MI get information command
isLastPackage = (p.packet[9] > 0x11); // > 0x11 indicates last packet received
else if (p.packet[0] != 0x00 && p.packet[0] != 0x88 && p.packet[0] != 0x92)
// ignore fragment number zero and MI status messages
isLastPackage = true; // response from dev control command
yield();
}

9
src/hm/miPayload.h

@ -221,14 +221,16 @@ const byteAssign_t InfoAssignment[] = {
for (uint8_t i = 0; i < 5; i++) {
iv->setValue(i, rec, (float) ((p->packet[(12+2*i)] << 8) + p->packet[(13+2*i)])/1);
}
iv->setQueuedCmdFinished();
/*iv->setQueuedCmdFinished();
mStat->rxSuccess++;
mSys->Radio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x01, false);
mSys->Radio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x01, false);*/
} else if ( p->packet[9] == 0x01 ) {//second frame
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") got 2nd frame (hw info)"));
mSys->Radio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x12, false);
//mSys->Radio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x12, false);
} else if ( p->packet[9] == 0x12 ) {//3rd frame
DPRINTLN(DBG_INFO, F("(#") + String(iv->id) + F(") got 3rd frame (hw info)"));
iv->setQueuedCmdFinished();
mStat->rxSuccess++;
}
} else if (p->packet[0] == (TX_REQ_INFO + ALL_FRAMES)) { // response from get information command
@ -723,6 +725,7 @@ const byteAssign_t InfoAssignment[] = {
}
IApp *mApp;
HMSYSTEM *mSys;
statistics_t *mStat;

Loading…
Cancel
Save