mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-06 09:58:23 +02:00
MI - use only crc8 for MI commands
MI-600 at least sents answers as well...
This commit is contained in:
parent
f4accf1e37
commit
1f0f8b904a
2 changed files with 8 additions and 7 deletions
|
@ -205,6 +205,7 @@ class HmRadio {
|
||||||
} else { //MI 2nd gen. specific
|
} else { //MI 2nd gen. specific
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case TurnOn:
|
case TurnOn:
|
||||||
|
//mTxBuf[0] = 0x50;
|
||||||
mTxBuf[9] = 0x55;
|
mTxBuf[9] = 0x55;
|
||||||
mTxBuf[10] = 0xaa;
|
mTxBuf[10] = 0xaa;
|
||||||
break;
|
break;
|
||||||
|
@ -223,7 +224,7 @@ class HmRadio {
|
||||||
}
|
}
|
||||||
cnt++;
|
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.
|
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);
|
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);
|
initPacket(invId, mid, pid);
|
||||||
sendPacket(invId, 10, isRetransmit, false);
|
sendPacket(invId, 10, isRetransmit, isMI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpBuf(uint8_t buf[], uint8_t len) {
|
void dumpBuf(uint8_t buf[], uint8_t len) {
|
||||||
|
@ -317,12 +318,12 @@ class HmRadio {
|
||||||
mTxBuf[9] = pid;
|
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, F("hmRadio.h:sendPacket"));
|
||||||
//DPRINTLN(DBG_VERBOSE, "sent packet: #" + String(mSendCnt));
|
//DPRINTLN(DBG_VERBOSE, "sent packet: #" + String(mSendCnt));
|
||||||
|
|
||||||
// append crc's
|
// append crc's
|
||||||
if (len > 10) {
|
if (appendCrc16 && len > 10) {
|
||||||
// crc control data
|
// crc control data
|
||||||
uint16_t crc = ah::crc16(&mTxBuf[10], len - 10);
|
uint16_t crc = ah::crc16(&mTxBuf[10], len - 10);
|
||||||
mTxBuf[len++] = (crc >> 8) & 0xff;
|
mTxBuf[len++] = (crc >> 8) & 0xff;
|
||||||
|
|
|
@ -149,7 +149,7 @@ class MiPayload {
|
||||||
if (cmd == 0x01 || cmd == SystemConfigPara ) { //0x1 and 0x05 for HM-types
|
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
|
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?
|
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 {
|
} else {
|
||||||
mSys->Radio.prepareDevInformCmd(iv->radioId.u64, cmd2, mPayload[iv->id].ts, iv->alarmMesIndex, false, cmd);
|
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;
|
mPayload[iv->id].retransmits = mMaxRetrans;
|
||||||
} else if ( cmd == 0x0f ) {
|
} else if ( cmd == 0x0f ) {
|
||||||
//hard/firmware request
|
//hard/firmware request
|
||||||
mSys->Radio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x00, true);
|
mSys->Radio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x00, true, true);
|
||||||
//iv->setQueuedCmdFinished();
|
//iv->setQueuedCmdFinished();
|
||||||
//cmd = iv->getQueuedCmd();
|
//cmd = iv->getQueuedCmd();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue