node 3 went life
This commit is contained in:
parent
8961f480c9
commit
89165c54bd
@ -13,13 +13,14 @@
|
||||
|
||||
// For Node definition:
|
||||
|
||||
#include "Node_1_def.h"
|
||||
#include "Node_3_def.h"
|
||||
|
||||
// Metro ticks in ms
|
||||
#define METRO_CAN_tick 1
|
||||
#define METRO_OW_read_tick 20
|
||||
#define METRO_OW_search_tick 10000
|
||||
// CAN bus
|
||||
//#define CAN_speed 125000
|
||||
#define CAN_speed 125000
|
||||
#define CAN_RS_PIN 2 //
|
||||
#define TEST_ADDR "125B275000000026"
|
||||
@ -272,10 +273,10 @@ void loop(void)
|
||||
Serial.print("pioA of switch ");
|
||||
Serial.print(switches[s_idx].nick);
|
||||
if (readout & 0x08) {
|
||||
Serial.println(F(" is now ON"));
|
||||
Serial.println(F(" is now OFF"));
|
||||
send_event(switches[s_idx].event_tag[0]);
|
||||
} else {
|
||||
Serial.println(F(" is now OFF"));
|
||||
Serial.println(F(" is now ON"));
|
||||
send_event(switches[s_idx].event_tag[1]);
|
||||
}
|
||||
action[0] = 0;
|
||||
@ -283,12 +284,11 @@ void loop(void)
|
||||
if (action[1]) {
|
||||
Serial.print("pioB of switch ");
|
||||
Serial.print(switches[s_idx].nick);
|
||||
Serial.print(" is now ");
|
||||
if (readout & 0x04) {
|
||||
Serial.println(F(" is now ON"));
|
||||
Serial.println(F(" is now OFF"));
|
||||
send_event(switches[s_idx].event_tag[2]);
|
||||
} else {
|
||||
Serial.println(F(" is now OFF"));
|
||||
Serial.println(F(" is now ON"));
|
||||
send_event(switches[s_idx].event_tag[3]);
|
||||
}
|
||||
action[1] = 0;
|
||||
|
@ -1,4 +1,3 @@
|
||||
// #include "CANNode.h"
|
||||
// Configuration
|
||||
#define NODE_ID 0x01
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// #include "CANNode.h"
|
||||
#include "CANNode.h"
|
||||
// Configuration
|
||||
#define NODE_ID 0x02
|
||||
|
||||
@ -27,8 +27,13 @@
|
||||
// Definitions
|
||||
static uint8_t node_id PROGMEM= { NODE_ID };
|
||||
static OW_switch_t switches[N_SWITCHES] PROGMEM={
|
||||
// nick, addr[8], event_tag[sw1, sw2]
|
||||
// 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 } },
|
||||
{ 11, { 0x12, 0xF2, 0x2A, 0x66, 0x0, 0x0, 0x0, 0x41 }, { 1, 1, 1, 1 } },
|
||||
{ 12, { 0x12, 0x37, 0x8A, 0x4F, 0x0, 0x0, 0x0, 0xE5 }, { 2, 2, 2, 2 } },
|
||||
{ 21, { 0x12, 0x86, 0xB4, 0x54, 0x0, 0x0, 0x0, 0x5F }, { 3, 3, 4, 4 } },
|
||||
{ 22, { 0x12, 0x84, 0xAD, 0x4F, 0x0, 0x0, 0x0, 0x12 }, { 5, 5, 6, 6 } },
|
||||
{ 31, { 0x12, 0x88, 0xDD, 0x53, 0x0, 0x0, 0x0, 0x28 }, { 210, 211, 220, 221 } }, // Roldenschalter (A - UP, B - DOWN)
|
||||
{ 0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0, 0, 0, 0 } }
|
||||
};
|
||||
static uint8_t switches_state[N_SWITCHES];
|
||||
@ -62,6 +67,10 @@ static event_t tx_events[N_EVENTS] PROGMEM={
|
||||
{ 8, 0x03, 0x01, TOGGLE, 0x08},
|
||||
{ 11, 0x03, 0x01, ON, 0x01},
|
||||
{ 12, 0x03, 0x01, ON, 0x02},
|
||||
{ 210, 0x03, 0xff, OFF, 0x06},
|
||||
{ 211, 0x03, 0xff, ON, 0x06},
|
||||
{ 220, 0x03, 0xff, OFF, 0x07},
|
||||
{ 221, 0x03, 0xff, ON, 0x07},
|
||||
{ 255, 0x03, 0xff, OFF, 0x09},
|
||||
{ 254, 0x03, 0xff, ON, 0x09},
|
||||
{ 10, 0x03, 0xff, TOGGLE, 0x01},
|
||||
@ -90,4 +99,8 @@ static action_t action_map[N_ACTIONS] PROGMEM={
|
||||
{7, 6},
|
||||
{8, 7},
|
||||
{9, 0},{9, 1},{9, 2},{9, 3},{9, 4},{9, 5},{9, 6},{9, 7},
|
||||
{210, 210},
|
||||
{211, 211},
|
||||
{220, 220},
|
||||
{221, 221},
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
// #include "CANNode.h"
|
||||
#include "CANNode.h"
|
||||
// Configuration
|
||||
#define NODE_ID 0x02
|
||||
#define NODE_ID 0x03
|
||||
|
||||
// Misc
|
||||
|
||||
@ -27,8 +27,14 @@
|
||||
// Definitions
|
||||
static uint8_t node_id PROGMEM= { NODE_ID };
|
||||
static OW_switch_t switches[N_SWITCHES] PROGMEM={
|
||||
// nick, addr[8], event_tag[sw1, sw2]
|
||||
// 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 } },
|
||||
{ 11, { 0x12, 0xF2, 0x2A, 0x66, 0x0, 0x0, 0x0, 0x41 }, { 0, 0, 0, 0 } }, // EZ -> Flur
|
||||
{ 12, { 0x12, 0x37, 0x8A, 0x4F, 0x0, 0x0, 0x0, 0xE5 }, { 10, 10, 10, 10 } },
|
||||
{ 13, { 0x12, 0x71, 0x51, 0x57, 0x0, 0x0, 0x0, 0x28 }, { 2, 2, 0, 0 } }, // Küche Kühlschank
|
||||
{ 21, { 0x12, 0x86, 0xB4, 0x54, 0x0, 0x0, 0x0, 0x5F }, { 3, 3, 4, 4 } },
|
||||
{ 22, { 0x12, 0x84, 0xAD, 0x4F, 0x0, 0x0, 0x0, 0x12 }, { 1, 1, 2, 2 } }, // EZ -> Küche
|
||||
{ 31, { 0x12, 0x88, 0xDD, 0x53, 0x0, 0x0, 0x0, 0x28 }, { 210, 211, 220, 221 } }, // Roldenschalter (A - UP, B - DOWN)
|
||||
{ 0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0, 0, 0, 0 } }
|
||||
};
|
||||
static uint8_t switches_state[N_SWITCHES];
|
||||
@ -52,16 +58,20 @@ static uint8_t outputs_state[N_OUTPUTS];
|
||||
static event_t tx_events[N_EVENTS] PROGMEM={
|
||||
// | --- ID --- |
|
||||
// tag, prio, dst, cmd, data
|
||||
{ 1, 0x03, 0x01, OFF, 0x01},
|
||||
{ 2, 0x03, 0x01, OFF, 0x02},
|
||||
{ 3, 0x03, 0x01, TOGGLE, 0x03},
|
||||
{ 4, 0x03, 0x01, TOGGLE, 0x04},
|
||||
{ 5, 0x03, 0x01, TOGGLE, 0x05},
|
||||
{ 6, 0x03, 0x01, TOGGLE, 0x06},
|
||||
{ 7, 0x03, 0x01, TOGGLE, 0x07},
|
||||
{ 8, 0x03, 0x01, TOGGLE, 0x08},
|
||||
{ 1, 0x03, 0x03, TOGGLE, 0x01},
|
||||
{ 2, 0x03, 0x03, TOGGLE, 0x02},
|
||||
{ 3, 0x03, 0x03, TOGGLE, 0x03},
|
||||
{ 4, 0x03, 0x03, TOGGLE, 0x04},
|
||||
{ 5, 0x03, 0x03, TOGGLE, 0x05},
|
||||
{ 6, 0x03, 0x03, TOGGLE, 0x06},
|
||||
{ 7, 0x03, 0x03, TOGGLE, 0x07},
|
||||
{ 8, 0x03, 0x03, TOGGLE, 0x08},
|
||||
{ 11, 0x03, 0x01, ON, 0x01},
|
||||
{ 12, 0x03, 0x01, ON, 0x02},
|
||||
{ 210, 0x03, 0xff, OFF, 0x06},
|
||||
{ 211, 0x03, 0xff, ON, 0x06},
|
||||
{ 220, 0x03, 0xff, OFF, 0x07},
|
||||
{ 221, 0x03, 0xff, ON, 0x07},
|
||||
{ 255, 0x03, 0xff, OFF, 0x09},
|
||||
{ 254, 0x03, 0xff, ON, 0x09},
|
||||
{ 10, 0x03, 0xff, TOGGLE, 0x01},
|
||||
@ -90,4 +100,8 @@ static action_t action_map[N_ACTIONS] PROGMEM={
|
||||
{7, 6},
|
||||
{8, 7},
|
||||
{9, 0},{9, 1},{9, 2},{9, 3},{9, 4},{9, 5},{9, 6},{9, 7},
|
||||
{210, 210},
|
||||
{211, 211},
|
||||
{220, 220},
|
||||
{221, 221},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user