[Nyx] Add button to force HOS boot screen logs

This commit is contained in:
ctcaer@gmail.com 2019-07-06 22:34:03 +03:00
parent 078ef1c4f1
commit 2bb0dba724
2 changed files with 34 additions and 2 deletions

View file

@ -961,11 +961,13 @@ void auto_launch_firmware()
free(BOOTLOGO); free(BOOTLOGO);
} }
if (!h_cfg.sept_run && h_cfg.bootwait) if (b_cfg.boot_cfg & BOOT_CFG_FROM_LAUNCH)
display_backlight_brightness(h_cfg.backlight, 0);
else if (!h_cfg.sept_run && h_cfg.bootwait)
display_backlight_brightness(h_cfg.backlight, 1000); display_backlight_brightness(h_cfg.backlight, 1000);
// Wait before booting. If VOL- is pressed go into bootloader menu. // Wait before booting. If VOL- is pressed go into bootloader menu.
if (!h_cfg.sept_run) if (!h_cfg.sept_run && !(b_cfg.boot_cfg & BOOT_CFG_FROM_LAUNCH))
{ {
btn = btn_wait_timeout(h_cfg.bootwait * 1000, BTN_VOL_DOWN); btn = btn_wait_timeout(h_cfg.bootwait * 1000, BTN_VOL_DOWN);

View file

@ -444,9 +444,13 @@ lv_obj_t *nyx_create_standard_window(const char *win_title)
return win; return win;
} }
static bool launch_logs_enable = false;
static void _launch_hos(u8 autoboot, u8 autoboot_list) static void _launch_hos(u8 autoboot, u8 autoboot_list)
{ {
b_cfg->boot_cfg = BOOT_CFG_AUTOBOOT_EN; b_cfg->boot_cfg = BOOT_CFG_AUTOBOOT_EN;
if (launch_logs_enable)
b_cfg->boot_cfg |= BOOT_CFG_FROM_LAUNCH;
b_cfg->autoboot = autoboot; b_cfg->autoboot = autoboot;
b_cfg->autoboot_list = autoboot_list; b_cfg->autoboot_list = autoboot_list;
@ -1421,6 +1425,29 @@ static lv_res_t _launch_action(lv_obj_t *btn)
return LV_RES_OK; return LV_RES_OK;
} }
static lv_res_t logs_onoff_toggle(lv_obj_t *btn)
{
launch_logs_enable = !launch_logs_enable;
lv_obj_t *label_btn = lv_obj_get_child(btn, NULL);
char label_text[64];
strcpy(label_text, lv_label_get_text(label_btn));
label_text[strlen(label_text) - 12] = 0;
if (!launch_logs_enable)
{
strcat(label_text, "#D0D0D0 OFF#");
lv_label_set_array_text(label_btn, label_text, 64);
}
else
{
strcat(label_text, "#00FFC9 ON #");
lv_label_set_array_text(label_btn, label_text, 64);
}
return LV_RES_OK;
}
typedef struct _launch_button_pos_t typedef struct _launch_button_pos_t
{ {
@ -1468,6 +1495,9 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
else else
win = create_window_launch(SYMBOL_GPS" More Configurations"); win = create_window_launch(SYMBOL_GPS" More Configurations");
lv_win_add_btn(win, NULL, SYMBOL_LIST" Logs #D0D0D0 OFF#", logs_onoff_toggle);
launch_logs_enable = false;
lv_cont_set_fit(lv_page_get_scrl(lv_win_get_content(win)), false, false); lv_cont_set_fit(lv_page_get_scrl(lv_win_get_content(win)), false, false);
lv_page_set_scrl_height(lv_win_get_content(win), 572); lv_page_set_scrl_height(lv_win_get_content(win), 572);