new switch in WZ

This commit is contained in:
mwaiblinger
2019-03-17 17:50:28 +01:00
parent 35263d8595
commit 732b91caef
6 changed files with 11515 additions and 9886 deletions
+4 -4
View File
@@ -131,9 +131,10 @@ uint32_t forgeid(uint8_t prio, uint8_t dst, uint8_t cmd, uint8_t type=0){
// Type: 0: SINGLE, 1: FIRST, 2: CONT, 3: LAST
return (prio<<26)+(type<<24)+(dst<<16)+(NODE_ID<<8)+cmd;
}
int CAN_send(uint8_t prio, uint8_t dst, uint8_t cmd, uint8_t data[], uint8_t type=0){
int CAN_send(uint8_t prio, uint8_t dst, uint8_t cmd, uint8_t* data, uint8_t data_size, uint8_t type=0){
txmsg.id = forgeid(prio, dst, cmd, type);
txmsg.len = sizeof(data);
txmsg.len = data_size;
for (uint8_t i = 0; i < txmsg.len; i++) { txmsg.buf[i] = data[i]; }
CANbus.write(txmsg);
}
@@ -294,11 +295,10 @@ void loop(void)
}
if (new_owd) {
// send new ID to all
CAN_send(NOTIFY, 0xFF, NEW_TWID, addr);
Serial.print("Found a device: ");
print_OW_Device(addr);
Serial.println();
CAN_send(NOTIFY, 0xFF, NEW_TWID, addr, sizeof(addr));
}
}
+2 -1
View File
@@ -31,7 +31,8 @@ static OW_switch_t switches[N_SWITCHES] PROGMEM={
// nick, addr[8], event_tag[pioA_FALL, pioA_RISE, pioB_FALL, pioB_RISE]
{ 255, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0, 0, 0, 0 } },
{ 21, { 0x12, 0x86, 0xB4, 0x54, 0x0, 0x0, 0x0, 0x5F }, { 23, 23, 37, 37 } }, // Flur
{ 22, { 0x12, 0xC7, 0x2F, 0xCF, 0x0, 0x0, 0x0, 0xAF }, { 22, 22, 21, 21 } }, // WZ
{ 22, { 0x12, 0xCE, 0x6E, 0xCA, 0x0, 0x0, 0x0, 0x9C }, { 22, 22, 21, 21 } }, // WZ
// { 22, { 0x12, 0xC7, 0x2F, 0xCF, 0x0, 0x0, 0x0, 0xAF }, { 22, 22, 21, 21 } }, // WZ
// { 22, { 0x12, 0x5E, 0xFF, 0x55, 0x0, 0x0, 0x0, 0x2C }, { 21, 21, 22, 22 } }, // WZ
{ 0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0, 0, 0, 0 } }
};