Skip to content

Commit

Permalink
feat: improve general submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
Otrebor671 committed Oct 31, 2024
1 parent 3d9f119 commit d8974d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion firmware/main/general/general_submenu/general_submenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ static void list_submenu_options() {
MIN(MAX(ctx->options_count - MAX_OPTIONS_NUM + 2, 0), items_offset);
items_offset = MIN(ctx->selected_option, items_offset);
oled_screen_clear_buffer();
oled_screen_display_text("< Back", 0, 0, OLED_DISPLAY_NORMAL);
char* str = malloc(20);
for (uint8_t i = 0; i < (MIN(ctx->options_count, MAX_OPTIONS_NUM - 1)); i++) {
bool is_selected = i + items_offset == ctx->selected_option;
sprintf(str, "%s", ctx->options[i + items_offset]);
oled_screen_display_text(str, 0, i + 1, is_selected);
oled_screen_display_text(str, is_selected ? 16 : 0, i + 1, is_selected);
if (is_selected) {
oled_screen_display_bitmap(minino_face, 0, (i + 1) * 8, 8, 8,
OLED_DISPLAY_NORMAL);
}
}
oled_screen_display_show();
free(str);
Expand Down

0 comments on commit d8974d3

Please sign in to comment.