Browse Source

MI - use only crc8 for MI commands

MI-600 at least sents answers as well...
pull/846/head
rejoe2 2 years ago
committed by GitHub
parent
commit
1f0f8b904a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/hm/hmRadio.h
  2. 4
      src/hm/miPayload.h

11
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;

4
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 {

Loading…
Cancel
Save