Browse Source

new switch in WZ

I_sense
mwaiblinger 5 years ago
parent
commit
732b91caef
  1. 19763
      Hardware/kicad/CANNode.kicad_pcb
  2. 1554
      Hardware/kicad/Modified.lib
  3. 44
      Hardware/kicad/max481e.lib
  4. 29
      Hardware/kicad/pca9306.lib
  5. 8
      src/CANNode.cpp
  6. 3
      src/Node_2_def.h

19763
Hardware/kicad/CANNode.kicad_pcb

File diff suppressed because it is too large

1554
Hardware/kicad/Modified.lib

File diff suppressed because it is too large

44
Hardware/kicad/max481e.lib

@ -0,0 +1,44 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# MAX481E
#
DEF MAX481E U 0 20 Y Y 1 F N
F0 "U" -240 450 50 H V C CNN
F1 "MAX481E" 30 450 50 H V L CNN
F2 "" 0 -700 50 H I C CNN
F3 "" 0 50 50 H I C CNN
ALIAS MAX483E MAX485E MAX487E MAX1487E MAX3485 MAX3483 MAX3486
$FPLIST
DIP*W7.62mm*
SOIC*3.9x4.9mm*P1.27mm*
$ENDFPLIST
DRAW
C -12 -145 14 0 1 10 F
C -1 59 14 0 1 10 F
C 65 75 14 0 1 10 F
S -300 400 300 -500 0 1 10 f
S 50 125 50 125 0 1 0 N
P 2 0 1 10 -160 -200 -75 -200 N
P 2 0 1 10 -160 100 -50 100 N
P 2 0 1 10 -50 -126 -50 -136 N
P 2 0 1 10 -25 -200 210 -200 N
P 3 0 1 10 -160 -100 -50 -100 -50 -125 N
P 3 0 1 10 0 50 0 0 -160 0 N
P 3 0 1 10 50 125 150 125 150 -200 N
P 3 0 1 10 100 75 100 -150 0 -150 N
P 4 0 1 10 -75 -125 -75 -225 25 -175 -75 -125 N
P 4 0 1 10 -50 100 50 150 50 50 -50 100 N
P 4 0 1 10 75 75 175 75 175 100 210 100 N
X RO 1 -400 100 100 R 50 50 1 1 O
X ~RE 2 -400 0 100 R 50 50 1 1 I
X DE 3 -400 -100 100 R 50 50 1 1 I
X DI 4 -400 -200 100 R 50 50 1 1 I
X GND 5 0 -600 100 U 50 50 1 1 W
X A 6 400 -200 100 L 50 50 1 1 B
X B 7 400 100 100 L 50 50 1 1 B
X VCC 8 0 500 100 D 50 50 1 1 W
ENDDRAW
ENDDEF
#
#End Library

29
Hardware/kicad/pca9306.lib

@ -0,0 +1,29 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# PCA9306
#
DEF PCA9306 U 0 40 Y Y 1 F N
F0 "U" -300 450 50 H V L CNN
F1 "PCA9306" 200 450 50 H V L CNN
F2 "" -400 350 50 H I C CNN
F3 "" -300 450 50 H I C CNN
$FPLIST
SSOP*2.95x2.8mm*P0.65mm*
VSSOP*2.3x2mm*P0.5mm*
X2SON*1.4x1mm*P0.35mm*
$ENDFPLIST
DRAW
S -300 400 300 -400 0 1 10 f
X GND 1 0 -500 100 U 50 50 1 1 W
X VREF1 2 -100 500 100 D 50 50 1 1 W
X SCL1 3 -400 -100 100 R 50 50 1 1 B
X SDA1 4 -400 0 100 R 50 50 1 1 B
X SDA2 5 400 0 100 L 50 50 1 1 B
X SCL2 6 400 -100 100 L 50 50 1 1 B
X VREF2 7 100 500 100 D 50 50 1 1 W
X EN 8 400 100 100 L 50 50 1 1 I
ENDDRAW
ENDDEF
#
#End Library

8
src/CANNode.cpp

@ -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 // Type: 0: SINGLE, 1: FIRST, 2: CONT, 3: LAST
return (prio<<26)+(type<<24)+(dst<<16)+(NODE_ID<<8)+cmd; 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.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]; } for (uint8_t i = 0; i < txmsg.len; i++) { txmsg.buf[i] = data[i]; }
CANbus.write(txmsg); CANbus.write(txmsg);
} }
@ -294,11 +295,10 @@ void loop(void)
} }
if (new_owd) { if (new_owd) {
// send new ID to all // send new ID to all
CAN_send(NOTIFY, 0xFF, NEW_TWID, addr);
Serial.print("Found a device: "); Serial.print("Found a device: ");
print_OW_Device(addr); print_OW_Device(addr);
Serial.println(); Serial.println();
CAN_send(NOTIFY, 0xFF, NEW_TWID, addr, sizeof(addr));
} }
} }

3
src/Node_2_def.h

@ -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] // 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 } }, { 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 { 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 // { 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 } } { 0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0, 0, 0, 0 } }
}; };

Loading…
Cancel
Save