From cced3d1d9396c1d0b3eeb77d86c1fdcb9cca9748 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Mon, 6 May 2024 03:42:27 +1000 Subject: [PATCH] let berry drivers provide "after_teleperiod" handlers (#21351) this is useful if you want to periodically report the state of something handled separately to the sensors output. --- lib/libesp32/berry_tasmota/src/embedded/driver_class.be | 1 + .../berry_tasmota/src/solidify/solidified_driver_class.h | 3 ++- tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/libesp32/berry_tasmota/src/embedded/driver_class.be b/lib/libesp32/berry_tasmota/src/embedded/driver_class.be index eb2fadc38..2efed4619 100644 --- a/lib/libesp32/berry_tasmota/src/embedded/driver_class.be +++ b/lib/libesp32/berry_tasmota/src/embedded/driver_class.be @@ -14,6 +14,7 @@ class Driver var save_before_restart var web_sensor var json_append + var after_teleperiod var button_pressed var display diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_driver_class.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_driver_class.h index 75351ee0c..2323e7f7d 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_driver_class.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_driver_class.h @@ -70,7 +70,7 @@ be_local_closure(Driver_add_cmd, /* name */ ** Solidified class: Driver ********************************************************************/ be_local_class(Driver, - 13, + 14, NULL, be_nested_map(14, ( (struct bmapnode*) &(const bmapnode[]) { @@ -87,6 +87,7 @@ be_local_class(Driver, { be_const_key(web_add_management_button, 0), be_const_var(5) }, { be_const_key(every_100ms, 13), be_const_var(1) }, { be_const_key(json_append, -1), be_const_var(10) }, + { be_const_key(after_teleperiod, -1), be_const_var(13) }, { be_const_key(web_add_button, -1), be_const_var(3) }, })), (bstring*) &be_const_str_Driver diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino index 2205b214f..dcab55b99 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino @@ -985,6 +985,9 @@ bool Xdrv52(uint32_t function) case FUNC_JSON_APPEND: callBerryEventDispatcher(PSTR("json_append"), nullptr, 0, nullptr); break; + case FUNC_AFTER_TELEPERIOD: + callBerryEventDispatcher(PSTR("after_teleperiod"), nullptr, 0, nullptr); + break; case FUNC_BUTTON_PRESSED: callBerryEventDispatcher(PSTR("button_pressed"), nullptr, 0, nullptr);