diff --git a/src/hm/hmRadio.h b/src/hm/hmRadio.h index c37ab7d0..3917df8e 100644 --- a/src/hm/hmRadio.h +++ b/src/hm/hmRadio.h @@ -205,6 +205,7 @@ class HmRadio { } else { //MI 2nd gen. specific switch (cmd) { case TurnOn: + //mTxBuf[0] = 0x50; mTxBuf[9] = 0x55; mTxBuf[10] = 0xaa; break; @@ -223,7 +224,7 @@ class HmRadio { } cnt++; } - sendPacket(invId, cnt, isRetransmit, true); + sendPacket(invId, cnt, isRetransmit, isNoMI); } void prepareDevInformCmd(uint64_t invId, uint8_t cmd, uint32_t ts, uint16_t alarmMesId, bool isRetransmit, uint8_t reqfld=TX_REQ_INFO) { // might not be necessary to add additional arg. @@ -239,9 +240,9 @@ class HmRadio { sendPacket(invId, 24, isRetransmit, true); } - void sendCmdPacket(uint64_t invId, uint8_t mid, uint8_t pid, bool isRetransmit) { + void sendCmdPacket(uint64_t invId, uint8_t mid, uint8_t pid, bool isRetransmit, bool isMI=false) { initPacket(invId, mid, pid); - sendPacket(invId, 10, isRetransmit, false); + sendPacket(invId, 10, isRetransmit, isMI); } void dumpBuf(uint8_t buf[], uint8_t len) { @@ -317,12 +318,12 @@ class HmRadio { mTxBuf[9] = pid; } - void sendPacket(uint64_t invId, uint8_t len, bool isRetransmit, bool clear=false) { + void sendPacket(uint64_t invId, uint8_t len, bool isRetransmit, bool appendCrc16=false) { //DPRINTLN(DBG_VERBOSE, F("hmRadio.h:sendPacket")); //DPRINTLN(DBG_VERBOSE, "sent packet: #" + String(mSendCnt)); // append crc's - if (len > 10) { + if (appendCrc16 && len > 10) { // crc control data uint16_t crc = ah::crc16(&mTxBuf[10], len - 10); mTxBuf[len++] = (crc >> 8) & 0xff; diff --git a/src/hm/miPayload.h b/src/hm/miPayload.h index fd2665f8..d9f0b338 100644 --- a/src/hm/miPayload.h +++ b/src/hm/miPayload.h @@ -149,7 +149,7 @@ class MiPayload { if (cmd == 0x01 || cmd == SystemConfigPara ) { //0x1 and 0x05 for HM-types cmd = 0x0f; // for MI, these seem to make part of the Polling the device software and hardware version number command cmd2 = cmd == SystemConfigPara ? 0x01 : 0x00; //perhaps we can only try to get second frame? - mSys->Radio.sendCmdPacket(iv->radioId.u64, cmd, cmd2, false); + mSys->Radio.sendCmdPacket(iv->radioId.u64, cmd, cmd2, false, true); } else { mSys->Radio.prepareDevInformCmd(iv->radioId.u64, cmd2, mPayload[iv->id].ts, iv->alarmMesIndex, false, cmd); }; @@ -442,7 +442,7 @@ const byteAssign_t InfoAssignment[] = { mPayload[iv->id].retransmits = mMaxRetrans; } else if ( cmd == 0x0f ) { //hard/firmware request - mSys->Radio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x00, true); + mSys->Radio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x00, true, true); //iv->setQueuedCmdFinished(); //cmd = iv->getQueuedCmd(); } else {