Add Xdrv function FUNC_BUTTON_MULTI_PRESSED

This commit is contained in:
Theo Arends 2021-11-30 14:55:45 +01:00
parent 6bd0140dd9
commit f2b98f7da3
3 changed files with 12 additions and 2 deletions

View File

@ -313,6 +313,13 @@ void ButtonHandler(void) {
}
}
}
XdrvMailbox.index = button_index;
XdrvMailbox.payload = Button.press_counter[button_index];
if (XdrvCall(FUNC_BUTTON_MULTI_PRESSED)) {
// Serviced
} else
#ifdef ROTARY_V1
if (!RotaryButtonPressed(button_index)) {
#endif

View File

@ -341,7 +341,7 @@ enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_PIN_STATE, FUNC_MODULE_INIT, FU
FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA,
FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY,
FUNC_ENERGY_EVERY_SECOND, FUNC_ENERGY_RESET,
FUNC_RULES_PROCESS, FUNC_TELEPERIOD_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED,
FUNC_RULES_PROCESS, FUNC_TELEPERIOD_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED, FUNC_BUTTON_MULTI_PRESSED,
FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_CONSOLE_BUTTON, FUNC_WEB_ADD_MANAGEMENT_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON,
FUNC_WEB_ADD_HANDLER, FUNC_SET_CHANNELS, FUNC_SET_SCHEME, FUNC_HOTPLUG_SCAN,
FUNC_DEVICE_GROUP_ITEM };

View File

@ -3205,6 +3205,9 @@ bool Xdrv04(uint8_t function)
case FUNC_SET_POWER:
LightSetPower();
break;
case FUNC_BUTTON_MULTI_PRESSED:
result = XlgtCall(FUNC_BUTTON_MULTI_PRESSED);
break;
case FUNC_COMMAND:
result = DecodeCommand(kLightCommands, LightCommand, kLightSynonyms);
if (!result) {