From 2bb0dba724adb543d0f5afc9f308335eca235cac Mon Sep 17 00:00:00 2001 From: "ctcaer@gmail.com" Date: Sat, 6 Jul 2019 22:34:03 +0300 Subject: [PATCH] [Nyx] Add button to force HOS boot screen logs --- bootloader/main.c | 6 ++++-- nyx/nyx_gui/frontend/gui.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/bootloader/main.c b/bootloader/main.c index 96203f1..92902b9 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -961,11 +961,13 @@ void auto_launch_firmware() 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); // 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); diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index 06181a6..127d577 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -444,9 +444,13 @@ lv_obj_t *nyx_create_standard_window(const char *win_title) return win; } +static bool launch_logs_enable = false; + static void _launch_hos(u8 autoboot, u8 autoboot_list) { 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_list = autoboot_list; @@ -1421,6 +1425,29 @@ static lv_res_t _launch_action(lv_obj_t *btn) 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 { @@ -1468,6 +1495,9 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn) else 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_page_set_scrl_height(lv_win_get_content(win), 572);