diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 366b9dc5f..7566cbfab 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -2188,6 +2188,7 @@ const char* g_obk_flagNames[] = { "[DRV] Deactivate Autostart of all drivers", "[WiFi] Quick connect to WiFi on reboot (TODO: check if it works for you and report on github)", "[Power] Set power and current to zero if all relays are open", + "[DoorSensor] Alternate wake up mode (always on falling edge)", "error", "error", "error", diff --git a/src/new_pins.c b/src/new_pins.c index 20980064c..cd8177b80 100644 --- a/src/new_pins.c +++ b/src/new_pins.c @@ -136,14 +136,19 @@ void PINS_BeginDeepSleepWithPinWakeUp() { || g_cfg.pins.roles[i] == IOR_DigitalInput_NoPup || g_cfg.pins.roles[i] == IOR_DigitalInput_NoPup_n) { //value = CHANNEL_Get(g_cfg.pins.channels[i]); - value = HAL_PIN_ReadDigitalInput(i); - if (value) { - // on falling edge wake up + if (CFG_HasFlag(OBK_FLAG_DOORSENSOR_ALWAYSWAKEONFALLING)) { falling = 1; } else { - // on rising edge wake up - falling = 0; + value = HAL_PIN_ReadDigitalInput(i); + if (value) { + // on falling edge wake up + falling = 1; + } + else { + // on rising edge wake up + falling = 0; + } } setGPIActive(i, 1, falling); } diff --git a/src/new_pins.h b/src/new_pins.h index 20260d397..1cd31e3ad 100644 --- a/src/new_pins.h +++ b/src/new_pins.h @@ -861,8 +861,9 @@ typedef struct pinsState_s { #define OBK_FLAG_DRV_DISABLE_AUTOSTART 36 #define OBK_FLAG_WIFI_FAST_CONNECT 37 #define OBK_FLAG_POWER_FORCE_ZERO_IF_RELAYS_OPEN 38 +#define OBK_FLAG_DOORSENSOR_ALWAYSWAKEONFALLING 39 -#define OBK_TOTAL_FLAGS 39 +#define OBK_TOTAL_FLAGS 40 #define LOGGER_FLAG_MQTT_DEDUPER 1 #define LOGGER_FLAG_POWER_SAVE 2