Skip to content

Commit

Permalink
fix: avoid screen saver in general screens
Browse files Browse the repository at this point in the history
  • Loading branch information
Otrebor671 committed Aug 22, 2024
1 parent 64cf8a2 commit 58b863d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
10 changes: 5 additions & 5 deletions firmware/main/general/general_screens.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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();
}

Expand All @@ -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);
}

Expand Down
7 changes: 0 additions & 7 deletions firmware/main/modules/keyboard/keyboard_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions firmware/main/modules/keyboard/keyboard_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
void keyboard_module_set_input_callback(input_callback_t input_cb);

0 comments on commit 58b863d

Please sign in to comment.