diff --git a/firmware/main/general/general_screens.c b/firmware/main/general/general_screens.c index 3347a39..39fb004 100644 --- a/firmware/main/general/general_screens.c +++ b/firmware/main/general/general_screens.c @@ -1,6 +1,6 @@ #include "general/general_screens.h" #include "general/bitmaps_general.h" -#include "keyboard_module.h" +#include "menus_module.h" #include "oled_screen.h" #define MAX_LINE_CHAR 16 @@ -103,7 +103,7 @@ static void general_screen_cb_modal(uint8_t button_name, uint8_t button_event) { case BUTTON_RIGHT: break; case BUTTON_LEFT: - keyboard_module_restore_input_callback(); + menus_module_set_app_state_last(); menu_exit_function(); break; default: @@ -130,7 +130,7 @@ static void general_screen_cb_scroll(uint8_t button_name, case BUTTON_LEFT: general_register_menu(current_menu_ctx); general_register_scrolling_menu(NULL); - keyboard_module_restore_input_callback(); + menus_module_set_app_state_last(); menu_exit_function(); break; default: @@ -186,7 +186,7 @@ void general_clear_screen() { void general_screen_display_scrolling_text_handler(void* callback_exit) { scrolling_option = 0; menu_exit_function = callback_exit; - keyboard_module_set_input_callback(general_screen_cb_scroll); + menus_module_set_app_state(true, general_screen_cb_scroll); general_screen_display_scrolling(); } @@ -196,7 +196,7 @@ void general_screen_display_card_information_handler(char* title, void* callback_restore) { menu_exit_function = callback_exit; menu_restore_function = callback_restore; - keyboard_module_set_input_callback(general_screen_cb_modal); + menus_module_set_app_state(true, general_screen_cb_modal); genera_screen_display_card_information(title, body); } diff --git a/firmware/main/modules/keyboard/keyboard_module.c b/firmware/main/modules/keyboard/keyboard_module.c index 0db2d49..111ceb0 100644 --- a/firmware/main/modules/keyboard/keyboard_module.c +++ b/firmware/main/modules/keyboard/keyboard_module.c @@ -8,7 +8,6 @@ static int IDLE_TIMEOUT_S = 30; static const char* TAG = "keyboard"; static input_callback_t input_callback = NULL; -static input_callback_t last_input_callback = NULL; esp_timer_handle_t idle_timer; static bool is_idle = false; static bool lock_input = false; @@ -98,14 +97,8 @@ static void button_event_cb(void* arg, void* data) { } void keyboard_module_set_input_callback(input_callback_t input_cb) { - last_input_callback = input_callback; input_callback = input_cb; } - -void keyboard_module_restore_input_callback() { - input_callback = last_input_callback; -} - void keyboard_module_begin() { #if !defined(CONFIG_KEYBOARD_DEBUG) esp_log_level_set(TAG, ESP_LOG_NONE); diff --git a/firmware/main/modules/keyboard/keyboard_module.h b/firmware/main/modules/keyboard/keyboard_module.h index a0e10b8..90677b6 100644 --- a/firmware/main/modules/keyboard/keyboard_module.h +++ b/firmware/main/modules/keyboard/keyboard_module.h @@ -54,5 +54,4 @@ void keyboard_module_reset_idle_timer(); void keyboard_module_set_lock(bool lock); -void keyboard_module_set_input_callback(input_callback_t input_cb); -void keyboard_module_restore_input_callback(); \ No newline at end of file +void keyboard_module_set_input_callback(input_callback_t input_cb); \ No newline at end of file