Skip to content

Commit

Permalink
feat: Adapt Display settings
Browse files Browse the repository at this point in the history
  • Loading branch information
JahazielLem committed Sep 21, 2024
1 parent 4ae7a2f commit fbf3cc9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion firmware/main/apps/ble/hid_device/hid_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void hid_module_display_notify_play_pause() {

void hid_module_display_device_pairing() {
led_control_run_effect(led_control_ble_spam_breathing);
genera_screen_display_notify_information("Pairing", "Waiting for connection");
genera_screen_display_notify_information("Pairing", "Waiting conn");
}

void hid_module_display_device_connection(bool status) {
Expand Down
6 changes: 5 additions & 1 deletion firmware/main/general/general_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ static void general_screen_decrement_option() {
}

static void general_screen_display_breadcrumb() {
if (current_menu_ctx == NULL) {
oled_screen_display_text("< Back", 0, 0, OLED_DISPLAY_NORMAL);
return;
}
if (current_menu_ctx->menu_level == GENERAL_TREE_APP_MENU) {
oled_screen_display_text("< Exit", 0, 0, OLED_DISPLAY_NORMAL);
} else {
Expand Down Expand Up @@ -197,7 +201,7 @@ void genera_screen_display_card_information(char* title, char* body) {

void genera_screen_display_notify_information(char* title, char* body) {
general_clear_screen();
// general_screen_display_breadcrumb();
general_screen_display_breadcrumb();
int page = ITEM_PAGE_OFFSET;
oled_screen_display_card_border();
oled_screen_display_text_center(title, page, OLED_DISPLAY_NORMAL);
Expand Down
25 changes: 17 additions & 8 deletions firmware/main/modules/settings/display/display_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
#define TIMER_MIN_TIME 30

#ifdef CONFIG_RESOLUTION_128X64
#define TIME_PAGE 4
#define Y_N_OFFSET 4
#define ITEMOFFSET 2
#define ITEMSPERSCREEN 4
#define TIME_PAGE 4
#define Y_N_OFFSET 4
#else // CONFIG_RESOLUTION_128X32
#define TIME_PAGE 3
#define Y_N_OFFSET 1
#define ITEMOFFSET 1
#define ITEMSPERSCREEN 2
#define TIME_PAGE 3
#define Y_N_OFFSET 1
#endif

typedef enum { DISPLAY_MENU, DISPLAY_LIST, DISPLAY_COUNT } display_menu_t;
Expand Down Expand Up @@ -73,19 +77,22 @@ static void display_config_display_list_logo() {
oled_screen_clear_buffer();
oled_screen_display_text("< Back", 0, 0, OLED_DISPLAY_NORMAL);
int current_scren = preferences_get_int("dp_select", 0);
for (int i = 0; epd_bitmaps_list[i] != NULL; i++) {
int position = 1;
uint16_t start_item = (selected_item / ITEMSPERSCREEN) * ITEMSPERSCREEN;
for (uint16_t i = start_item;
i < start_item + ITEMSPERSCREEN && epd_bitmaps_list[i] != NULL; i++) {
char display_text[18];
if (i == current_scren) {
sprintf(display_text, "%s..[Curr]", epd_bitmaps_list[i]);
} else {
sprintf(display_text, "%s", epd_bitmaps_list[i]);
}
int page = (i + 1);
if (selected_item == i) {
config_module_wifi_display_selected_item(display_text, page);
config_module_wifi_display_selected_item(display_text, position);
} else {
oled_screen_display_text(display_text, 0, page, OLED_DISPLAY_NORMAL);
oled_screen_display_text(display_text, 0, position, OLED_DISPLAY_NORMAL);
}
position = position + ITEMOFFSET;
}
oled_screen_display_show();
}
Expand Down Expand Up @@ -169,6 +176,7 @@ static void display_config_module_state_machine_menu_time(
}
switch (button_name) {
case BUTTON_LEFT:
selected_item = 0;
menus_module_set_app_state(true, display_config_module_state_machine);
display_config_display_menu_item();
break;
Expand Down Expand Up @@ -209,6 +217,7 @@ static void display_config_module_state_machine_menu_logo(
}
switch (button_name) {
case BUTTON_LEFT:
selected_item = 0;
menus_module_set_app_state(true, display_config_module_state_machine);
display_config_display_menu_item();
break;
Expand Down

0 comments on commit fbf3cc9

Please sign in to comment.