Skip to content

Commit

Permalink
feat: modals screen refresh improved
Browse files Browse the repository at this point in the history
  • Loading branch information
Otrebor671 committed Aug 30, 2024
1 parent 2bccfca commit b11147f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions firmware/main/modules/modals/modals_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@
#define MAX_OPTIONS_NUM 7

void modals_screens_list_y_n_options_cb(modal_get_user_selection_t* ctx) {
oled_screen_clear();
oled_screen_clear_buffer();
oled_screen_display_text(ctx->banner, 0, 0, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center(ctx->options[0], 3,
ctx->selected_option == 0);
oled_screen_display_text_center(ctx->options[1], 4,
ctx->selected_option == 1);
oled_screen_display_show();
}

void modals_screens_default_list_options_cb(modal_get_user_selection_t* ctx) {
static uint8_t items_offset = 0;
items_offset = MAX(ctx->selected_option - 6, items_offset);
items_offset = MIN(ctx->selected_option, items_offset);
oled_screen_clear();
oled_screen_clear_buffer();
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++) {
oled_screen_display_text_center(ctx->options[i + items_offset], i + 2,
ctx->selected_option == i + items_offset);
}
oled_screen_display_show();
}

void modals_screens_default_list_radio_options_cb(
Expand All @@ -48,10 +50,11 @@ void modals_screens_default_list_radio_options_cb(
}

void modals_screens_show_info(char* head, char* body, size_t time_ms) {
oled_screen_clear();
oled_screen_clear_buffer();
int page = 2;
oled_screen_display_text_center(head, 0, OLED_DISPLAY_NORMAL);
oled_screen_display_text_splited(body, &page, OLED_DISPLAY_NORMAL);
oled_screen_display_show();
vTaskDelay(pdMS_TO_TICKS(time_ms));
oled_screen_clear();
}
Expand Down
1 change: 1 addition & 0 deletions firmware/main/modules/screen_saver/screen_saver.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static void show_splash_screen() {
static int y_direction = 1;

while (screen_saver_running) {
// oled_screen_clear_buffer();
oled_screen_display_bitmap(logo.bitmap, start_x_position, start_y_position,
logo.width, logo.height, OLED_DISPLAY_NORMAL);

Expand Down

0 comments on commit b11147f

Please sign in to comment.