Skip to content

Commit

Permalink
feat: file manager refresh improved & scrolling card information fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Otrebor671 committed Aug 29, 2024
1 parent bd7e5c4 commit e32221d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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);
}

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

Expand Down
7 changes: 3 additions & 4 deletions firmware/main/general/general_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion firmware/main/modules/file_manager/file_manager_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {}
Expand Down
1 change: 0 additions & 1 deletion firmware/main/modules/oled_screen/oled_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion firmware/main/modules/oled_screen/oled_screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
void oled_screen_clear_buffer();
void oled_screen_display_show();

0 comments on commit e32221d

Please sign in to comment.