Skip to content

Commit

Permalink
Berry FUNC_ANY_KEY event calling any_key() (#21708)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Jun 29, 2024
1 parent 117eb79 commit 8d2d121
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 22 additions & 0 deletions tasmota/tasmota_xdrv_driver/xdrv_52_9_berry.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8d2d121

Please sign in to comment.