From 8d2d121b6d341536d13b49594fe57c8449653722 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Sat, 29 Jun 2024 22:12:34 +0200 Subject: [PATCH] Berry `FUNC_ANY_KEY` event calling `any_key()` (#21708) --- CHANGELOG.md | 1 + .../tasmota_xdrv_driver/xdrv_52_9_berry.ino | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fb703c7150a..ed1b71b6c8fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - ESP32 support for power and energy limit checks, like ``MaxEnergy2`` per phase (#21695) - Berry `tasmota.rtc("config_time")` (#21698) - Berry `math.min()` and `math.max()` +- Berry `FUNC_ANY_KEY` event calling `any_key()` ### Breaking Changed diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino index 3ea6508ad2d3..7384f1ebbf7d 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino @@ -946,6 +946,28 @@ bool Xdrv52(uint32_t function) case FUNC_SET_DEVICE_POWER: result = callBerryEventDispatcher(PSTR("set_power_handler"), nullptr, XdrvMailbox.index, nullptr); break; + case FUNC_ANY_KEY: + // XdrvMailbox.payload = device_save << 24 | key << 16 | state << 8 | device; + // key 0 = KEY_BUTTON = button_topic + // key 1 = KEY_SWITCH = switch_topic + // state 0 = POWER_OFF = off + // state 1 = POWER_ON = on + // state 2 = POWER_TOGGLE = toggle + // state 3 = POWER_HOLD = hold + // state 4 = POWER_INCREMENT = button still pressed + // state 5 = POWER_INV = button released + // state 6 = POWER_CLEAR = button released + // state 7 = POWER_RELEASE = button released + // state 9 = CLEAR_RETAIN = clear retain flag + // state 10 = POWER_DELAYED = button released delayed + // Button Multipress + // state 10 = SINGLE + // state 11 = DOUBLE + // state 12 = TRIPLE + // state 13 = QUAD + // state 14 = PENTA + result = callBerryEventDispatcher("any_key", nullptr, XdrvMailbox.payload, nullptr); + break; #ifdef USE_WEBSERVER case FUNC_WEB_ADD_CONSOLE_BUTTON: if (XdrvMailbox.index) {