From b0fe84070f949e00ec848adf97c7e88434bfc9b1 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 26 Oct 2021 10:55:11 +0300 Subject: [PATCH] nyx: add new touch panel fw info Additionally, do not alloc/free heap every time status bar update must run --- nyx/nyx_gui/frontend/gui.c | 7 ++++--- nyx/nyx_gui/frontend/gui_info.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index 1622b90..8dd579d 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -1209,7 +1209,7 @@ static void _create_tab_about(lv_theme_t * th, lv_obj_t * parent) static void _update_status_bar(void *params) { - char *label = (char *)malloc(128); + static char *label = NULL; u16 soc_temp = 0; u32 batt_percent = 0; @@ -1240,6 +1240,9 @@ static void _update_status_bar(void *params) else if (soc_temp_dec < 40) set_fan_duty(0); + if (!label) + label = (char *)malloc(512); + // Set time and SoC temperature. s_printf(label, "%02d:%02d "SYMBOL_DOT" "SYMBOL_TEMPERATURE" %02d.%d", time.hour, time.min, soc_temp_dec, (soc_temp & 0xFF) / 10); @@ -1283,8 +1286,6 @@ static void _update_status_bar(void *params) lv_label_set_text(status_bar.battery_more, label); lv_obj_realign(status_bar.battery_more); - - free(label); } static lv_res_t _create_mbox_payloads(lv_obj_t *btn) diff --git a/nyx/nyx_gui/frontend/gui_info.c b/nyx/nyx_gui/frontend/gui_info.c index fb743cb..b895ccd 100644 --- a/nyx/nyx_gui/frontend/gui_info.c +++ b/nyx/nyx_gui/frontend/gui_info.c @@ -946,6 +946,7 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn) panel_ic_paired = touch_panel->idx == 0; // NISSHA NFT-K12D. break; case 0x98000004: // New 6.2" panel? + case 0x50000001: strcat(txt_buf, "FST2 UNK"); if (touch_panel) panel_ic_paired = touch_panel->idx == 0;