fix some buttons snafu & power off led on suspend

This commit is contained in:
philippe44
2023-09-16 19:42:31 -07:00
parent bb185d76dc
commit 66b88d186a
4 changed files with 19 additions and 5 deletions

View File

@@ -192,8 +192,9 @@ static void control_handler(void *client, button_event_e event, button_press_e p
// in raw mode, we just do normal action press *and* release, there is no longpress nor shift
if (current_raw_controls && action_detail.action != ACTRLS_SLEEP) {
ESP_LOGD(TAG, "calling action %u in raw mode", key->normal[0].action);
if (current_controls[key->normal[0].action]) (*current_controls[key->normal[0].action])(event == BUTTON_PRESSED);
actrls_action_e action = key->normal[0].action != ACTRLS_NONE ? key->normal[0].action : key->normal[1].action;
ESP_LOGD(TAG, "calling action %u in raw mode", action);
if (action != ACTRLS_NONE && current_controls[action]) current_controls[action](event == BUTTON_PRESSED);
return;
}
@@ -218,7 +219,7 @@ static void control_handler(void *client, button_event_e event, button_press_e p
ESP_LOGE(TAG,"Invalid profile name %s. Cannot remap buttons",action_detail.name);
}
} else if (action_detail.action == ACTRLS_SLEEP) {
ESP_LOGI(TAG, "Sleep button pressed");
ESP_LOGI(TAG, "special sleep button pressed");
services_sleep_activate(SLEEP_ONKEY);
} else if (action_detail.action != ACTRLS_NONE) {
ESP_LOGD(TAG, "calling action %u", action_detail.action);