Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Berry FUNC_ANY_KEY event calling any_key() #21708

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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