-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to make room unit emulation work with version 4.1
- Loading branch information
Showing
5 changed files
with
60 additions
and
78 deletions.
There are no files selected for viewing
45 changes: 21 additions & 24 deletions
45
BSB_LAN/custom_functions/Emulation_of_Presence_Buttons/BSB_LAN_custom.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
/* | ||
* Emulation of presence buttons for room units as well as DHW/TWW push functionality on selected pins. | ||
* Buttons need to be connected to the pins defined in variable "button_on_pin" in BSB_LAN_custom_global.h | ||
* Parameters 10102, 10103 and 10104 need to be copied from version 2.2.1's BSB_LAN_custom_defs.h and added to current BSB_LAN_custom_defs.h | ||
* If these parameter numbers are already in use, changes need to be made to the parameter numbers in BSB_LAN_custom.h | ||
* Note regarding to pins: On Arduino Due any Digital pins can be selected excluding 12, 16-21, 31, 33, 53. | ||
* On ESP32, this depends on the model used. | ||
* Make sure you aren't using pins which are already in use for sensors or change them accordingly. | ||
*/ | ||
|
||
if (PressedButtons) { | ||
for (uint8_t i = 0; i < 8; i++) { | ||
switch (PressedButtons & (0x01 << i)) { | ||
case TWW_PUSH_BUTTON_PRESSED: | ||
strcpy(decodedTelegram.value, "1"); | ||
set(1603, decodedTelegram.value, true); | ||
PressedButtons &= ~TWW_PUSH_BUTTON_PRESSED; | ||
break; | ||
case ROOM1_PRESENCE_BUTTON_PRESSED: | ||
switchPresenceState(701, 10102); | ||
PressedButtons &= ~ROOM1_PRESENCE_BUTTON_PRESSED; | ||
break; | ||
case ROOM2_PRESENCE_BUTTON_PRESSED: | ||
switchPresenceState(1001, 10103); | ||
PressedButtons &= ~ROOM2_PRESENCE_BUTTON_PRESSED; | ||
break; | ||
case ROOM3_PRESENCE_BUTTON_PRESSED: | ||
switchPresenceState(1301, 10104); | ||
PressedButtons &= ~ROOM3_PRESENCE_BUTTON_PRESSED; | ||
break; | ||
default: PressedButtons &= ~(0x01 << i); break; //clear unknown state | ||
} | ||
if (PressedButtons) { | ||
for (uint8_t i = 0; i < 8; i++) { | ||
switch (PressedButtons & (0x01 << i)) { | ||
case TWW_PUSH_BUTTON_PRESSED: | ||
set(10019, "1", true); | ||
PressedButtons = PressedButtons & ~TWW_PUSH_BUTTON_PRESSED; | ||
break; | ||
case ROOM1_PRESENCE_BUTTON_PRESSED: | ||
switchPresenceState(10110, 0); | ||
PressedButtons = PressedButtons & ~ROOM1_PRESENCE_BUTTON_PRESSED; | ||
break; | ||
case ROOM2_PRESENCE_BUTTON_PRESSED: | ||
switchPresenceState(10111, 1); | ||
PressedButtons = PressedButtons & ~ROOM2_PRESENCE_BUTTON_PRESSED; | ||
break; | ||
case ROOM3_PRESENCE_BUTTON_PRESSED: | ||
switchPresenceState(10112, 2); | ||
PressedButtons = PressedButtons & ~ROOM3_PRESENCE_BUTTON_PRESSED; | ||
break; | ||
default: PressedButtons = PressedButtons & ~(0x01 << i); break; //clear unknown state | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 16 additions & 18 deletions
34
BSB_LAN/custom_functions/Emulation_of_Presence_Buttons/BSB_LAN_custom_setup.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
/* | ||
* Emulation of presence buttons for room units as well as DHW/TWW push functionality on selected pins. | ||
* Buttons need to be connected to the pins defined in variable "button_on_pin" in BSB_LAN_custom_global.h | ||
* Parameters 10102, 10103 and 10104 need to be copied from version 2.2.1's BSB_LAN_custom_defs.h and added to current BSB_LAN_custom_defs.h | ||
* If these parameter numbers are already in use, changes need to be made to the parameter numbers in BSB_LAN_custom.h | ||
* Note regarding to pins: On Arduino Due any Digital pins can be selected excluding 12, 16-21, 31, 33, 53. | ||
* On ESP32, this depends on the model used. | ||
* Make sure you aren't using pins which are already in use for sensors or change them accordingly. | ||
*/ | ||
|
||
if (button_on_pin[0]) { | ||
pinMode(button_on_pin[0], INPUT_PULLUP); | ||
attachInterrupt(digitalPinToInterrupt(button_on_pin[0]), interruptHandlerTWWPush, FALLING); //TWW push button | ||
} | ||
if (button_on_pin[1]) { | ||
pinMode(button_on_pin[1], INPUT_PULLUP); | ||
attachInterrupt(digitalPinToInterrupt(button_on_pin[1]), interruptHandlerPresenceROOM1, FALLING); //Presence ROOM 1 button | ||
} | ||
if (button_on_pin[2]) { | ||
pinMode(button_on_pin[2], INPUT_PULLUP); | ||
attachInterrupt(digitalPinToInterrupt(button_on_pin[2]), interruptHandlerPresenceROOM2, FALLING); //Presence ROOM 2 button | ||
} | ||
if (button_on_pin[3]) { | ||
pinMode(button_on_pin[3], INPUT_PULLUP); | ||
attachInterrupt(digitalPinToInterrupt(button_on_pin[3]), interruptHandlerPresenceROOM3, FALLING); //Presence ROOM 3 button | ||
} | ||
if (button_on_pin[0]) { | ||
pinMode(button_on_pin[0], INPUT_PULLUP); | ||
attachInterrupt(digitalPinToInterrupt(button_on_pin[0]), interruptHandlerTWWPush, FALLING); //TWW push-button | ||
} | ||
if (button_on_pin[1]) { | ||
pinMode(button_on_pin[1], INPUT_PULLUP); | ||
attachInterrupt(digitalPinToInterrupt(button_on_pin[1]), interruptHandlerPresenceROOM1, FALLING); //Presence ROOM 1 button | ||
} | ||
if (button_on_pin[2]) { | ||
pinMode(button_on_pin[2], INPUT_PULLUP); | ||
attachInterrupt(digitalPinToInterrupt(button_on_pin[2]), interruptHandlerPresenceROOM2, FALLING); //Presence ROOM 2 button | ||
} | ||
if (button_on_pin[3]) { | ||
pinMode(button_on_pin[3], INPUT_PULLUP); | ||
attachInterrupt(digitalPinToInterrupt(button_on_pin[3]), interruptHandlerPresenceROOM3, FALLING); //Presence ROOM 3 button | ||
} |
8 changes: 3 additions & 5 deletions
8
BSB_LAN/custom_functions/Emulation_of_Presence_Buttons/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters