diff --git a/firmware/main/general/general_radio_selection/general_radio_selection.c b/firmware/main/general/general_radio_selection/general_radio_selection.c index f2dc815..f3baf78 100644 --- a/firmware/main/general/general_radio_selection/general_radio_selection.c +++ b/firmware/main/general/general_radio_selection/general_radio_selection.c @@ -23,7 +23,7 @@ static void list_radio_options_old_style() { items_offset = MAX(ctx->selected_option - 4, items_offset); items_offset = MIN(MAX(ctx->options_count - 4, 0), items_offset); items_offset = MIN(ctx->selected_option, items_offset); - oled_screen_clear(); + oled_screen_clear_buffer(); char* str = malloc(20); oled_screen_display_text(ctx->banner, 0, 0, OLED_DISPLAY_NORMAL); for (uint8_t i = 0; i < (MIN(ctx->options_count, MAX_OPTIONS_NUM - 1)); i++) { @@ -33,6 +33,7 @@ static void list_radio_options_old_style() { sprintf(str, "[%c] %s", state, ctx->options[i + items_offset]); oled_screen_display_text(str, 0, i + 2, is_selected); } + oled_screen_display_show(); free(str); } @@ -42,7 +43,7 @@ static void list_radio_options_new_style() { items_offset = MAX(ctx->selected_option - 4, items_offset); items_offset = MIN(MAX(ctx->options_count - 4, 0), items_offset); items_offset = MIN(ctx->selected_option, items_offset); - oled_screen_clear(); + oled_screen_clear_buffer(); char* str = malloc(20); oled_screen_display_text(ctx->banner, 0, 0, OLED_DISPLAY_NORMAL); for (uint8_t i = 0; i < (MIN(ctx->options_count, MAX_OPTIONS_NUM - 1)); i++) { @@ -54,6 +55,7 @@ static void list_radio_options_new_style() { is_current ? "[curr]" : ""); oled_screen_display_text(str, is_selected ? 16 : 0, i + 2, is_selected); } + oled_screen_display_show(); free(str); } diff --git a/firmware/main/general/general_screens.c b/firmware/main/general/general_screens.c index e91ba41..46908ad 100644 --- a/firmware/main/general/general_screens.c +++ b/firmware/main/general/general_screens.c @@ -82,10 +82,9 @@ static void general_screen_increment_option() { } static void general_screen_decrement_option() { - scrolling_option--; - if (scrolling_option < 0) { - scrolling_option = scrolling_menu_ctx->menu_count - 1; - } + scrolling_option = scrolling_option-- == 0 + ? scrolling_menu_ctx->menu_count - 1 + : scrolling_option; } static void general_screen_display_breadcrumb() { diff --git a/firmware/main/modules/file_manager/file_manager_screens.c b/firmware/main/modules/file_manager/file_manager_screens.c index c9d96cd..458313a 100644 --- a/firmware/main/modules/file_manager/file_manager_screens.c +++ b/firmware/main/modules/file_manager/file_manager_screens.c @@ -8,7 +8,7 @@ static void update_list(file_manager_context_t* ctx) { items_offset = MAX(ctx->selected_item - 6, items_offset); items_offset = MIN(MAX(ctx->items_count - 7, 0), items_offset); items_offset = MIN(ctx->selected_item, items_offset); - oled_screen_clear(); + oled_screen_clear_buffer(); oled_screen_display_text("< Back", 0, 0, OLED_DISPLAY_NORMAL); if (ctx->items_count == 0) { oled_screen_display_text(" Empty folder ", 0, 3, OLED_DISPLAY_NORMAL); @@ -23,6 +23,7 @@ static void update_list(file_manager_context_t* ctx) { free(str); } } + oled_screen_display_show(); } static void show_fatal_error(char* error_tag) {} diff --git a/firmware/main/modules/oled_screen/oled_screen.c b/firmware/main/modules/oled_screen/oled_screen.c index 4aff232..01d094c 100644 --- a/firmware/main/modules/oled_screen/oled_screen.c +++ b/firmware/main/modules/oled_screen/oled_screen.c @@ -61,7 +61,6 @@ void oled_screen_display_show() { oled_driver_show_buffer(&dev); xSemaphoreGive(oled_mutex); } - void oled_screen_clear_buffer() { xSemaphoreTake(oled_mutex, portMAX_DELAY); oled_driver_clear_buffer(&dev); diff --git a/firmware/main/modules/oled_screen/oled_screen.h b/firmware/main/modules/oled_screen/oled_screen.h index 7e1ad4c..48bc947 100644 --- a/firmware/main/modules/oled_screen/oled_screen.h +++ b/firmware/main/modules/oled_screen/oled_screen.h @@ -133,4 +133,5 @@ void oled_screen_display_text_splited(char* p_text, void oled_screen_display_loading_bar(uint8_t value, uint8_t page); void oled_screen_display_card_border(); -void oled_screen_clear_buffer(); \ No newline at end of file +void oled_screen_clear_buffer(); +void oled_screen_display_show(); \ No newline at end of file