add flag to disable doorbell

This commit is contained in:
Nicu Hodos 2024-12-02 09:11:59 +01:00
parent ed5723e356
commit d123f08181
4 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,7 @@
#pragma once #pragma once
#if ENABLE_DOORBELL
#include "Protocol.h" #include "Protocol.h"
#define BIT_LENGTH 40 #define BIT_LENGTH 40
@ -56,3 +59,4 @@ private:
interrupts(); interrupts();
} }
} doorbell; } doorbell;
#endif

View File

@ -121,6 +121,7 @@ Command* commands[] = {
.addPreconfigured(HaESP::heapStats) .addPreconfigured(HaESP::heapStats)
.addPreconfigured(HaESP::restartInfo) .addPreconfigured(HaESP::restartInfo)
.build(), .build(),
#if ENABLE_DOORBELL
Builder<Button>::instance(new Button{"Front door", "doorbell_front", Builder<Button>::instance(new Button{"Front door", "doorbell_front",
[](const char* msg) { [](const char* msg) {
if (strcmp("PRESS", msg) == 0) doorbell.ring("00000000110100101000100"); if (strcmp("PRESS", msg) == 0) doorbell.ring("00000000110100101000100");
@ -134,6 +135,7 @@ Command* commands[] = {
.withParent(gatewayDevice) .withParent(gatewayDevice)
) )
.build(), .build(),
#endif
new EasyHomeSwitch{'A', (unsigned long[4]) { 4483136, 4626800, 4661552, 4819632 }, (unsigned long[4]) { 4326544, 4537104, 4767520, 4972704 }, "FritzBox", "Basement"}, new EasyHomeSwitch{'A', (unsigned long[4]) { 4483136, 4626800, 4661552, 4819632 }, (unsigned long[4]) { 4326544, 4537104, 4767520, 4972704 }, "FritzBox", "Basement"},
new EasyHomeSwitch{'B', (unsigned long[4]) { 4483140, 4626804, 4661556, 4819636 }, (unsigned long[4]) { 4326548, 4537108, 4767524, 4972708 }}, new EasyHomeSwitch{'B', (unsigned long[4]) { 4483140, 4626804, 4661556, 4819636 }, (unsigned long[4]) { 4326548, 4537108, 4767524, 4972708 }},
new PollinSwitch{"00001", 1, "Meeting sensor", "Dining room"}, new PollinSwitch{"00001", 1, "Meeting sensor", "Dining room"},

View File

@ -20,7 +20,7 @@ lib_deps =
adafruit/Adafruit Unified Sensor@^1.1.4 adafruit/Adafruit Unified Sensor@^1.1.4
adafruit/DHT sensor library@1.3.2 adafruit/DHT sensor library@1.3.2
https://git.hodos.ro/libraries/serial-reader.git@^1.0.0 https://git.hodos.ro/libraries/serial-reader.git@^1.0.0
build_flags = -D DHT_SENSOR=0 -D DEBUG_RAW=0 build_flags = -D DHT_SENSOR=0 -D DEBUG_RAW=0 -D ENABLE_DOORBELL=0
check_tool = cppcheck check_tool = cppcheck
check_flags = --enable=all check_flags = --enable=all
check_skip_packages = yes check_skip_packages = yes

View File

@ -37,8 +37,10 @@ Protocol* findProtocol(unsigned int protocol) {
return &protocol1; return &protocol1;
case PROTOCOL_2: case PROTOCOL_2:
return &protocol2; return &protocol2;
#if ENABLE_DOORBELL
case PROTOCOL_13: case PROTOCOL_13:
return &doorbell; return &doorbell;
#endif
default: default:
return &fallbackProtocol.setProtocol(protocol); return &fallbackProtocol.setProtocol(protocol);
} }