From b52b3e57f12fd0f02599dba62f1c025b0bf40d59 Mon Sep 17 00:00:00 2001 From: gmazzucchi Date: Mon, 12 Aug 2024 21:50:47 +0200 Subject: [PATCH] update canlib and fix lvgl crashes desburing, cit. E.Advisor --- Core/Lib/lvgl-stm32/lvgl | 2 +- Core/UI/steering/controls.c | 1 + .../racing_tabs/precharge_bar_popup.c | 1 + Core/UI/steering/racing_tabs/tab_hv.c | 2 + Core/UI/steering/racing_tabs/tab_lv.c | 2 + Core/UI/steering/steering.c | 55 ++++++++----------- Core/UI/steering/steering_config.h | 1 + Core/UI/steering/tab_manager.c | 6 +- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Core/Lib/lvgl-stm32/lvgl b/Core/Lib/lvgl-stm32/lvgl index df959661..c99a5f5a 160000 --- a/Core/Lib/lvgl-stm32/lvgl +++ b/Core/Lib/lvgl-stm32/lvgl @@ -1 +1 @@ -Subproject commit df959661bbe7d0b8df6eb4e26db295d71ff00851 +Subproject commit c99a5f5ae0dd0a69052f92e1484651c6b56aa006 diff --git a/Core/UI/steering/controls.c b/Core/UI/steering/controls.c index bc7a002b..c71c876b 100644 --- a/Core/UI/steering/controls.c +++ b/Core/UI/steering/controls.c @@ -564,6 +564,7 @@ void prepare_set_car_status(void) { case primary_ecu_status_status_drive: case primary_ecu_status_status_disable_inv_drive: case primary_ecu_status_status_start_ts_discharge: + case primary_ecu_status_status_re_enable_inverter_drive: case primary_ecu_status_status_wait_ts_discharge: { // disabled because the central buttons reads badly at the hardware level // send_set_car_status(primary_ecu_set_status_status_idle); diff --git a/Core/UI/steering/racing_tabs/precharge_bar_popup.c b/Core/UI/steering/racing_tabs/precharge_bar_popup.c index 00386aaf..45783700 100644 --- a/Core/UI/steering/racing_tabs/precharge_bar_popup.c +++ b/Core/UI/steering/racing_tabs/precharge_bar_popup.c @@ -10,6 +10,7 @@ void precharge_bar_screen_create(lv_obj_t *screen) { lv_style_set_radius(&precharge_bar_style_precharge, 0); lv_style_set_bg_opa(&precharge_bar_style_precharge, LV_OPA_COVER); lv_style_set_bg_color(&precharge_bar_style_precharge, lv_palette_main(LV_PALETTE_YELLOW)); + // Gradient makes performances much worse // lv_style_set_bg_grad_color(&precharge_bar_style_precharge, lv_palette_main(LV_PALETTE_RED)); // lv_style_set_bg_grad_dir(&precharge_bar_style_precharge, LV_GRAD_DIR_HOR); diff --git a/Core/UI/steering/racing_tabs/tab_hv.c b/Core/UI/steering/racing_tabs/tab_hv.c index e69227c5..384bfe80 100644 --- a/Core/UI/steering/racing_tabs/tab_hv.c +++ b/Core/UI/steering/racing_tabs/tab_hv.c @@ -269,6 +269,7 @@ void init_hv_styles(void) { lv_style_set_radius(&tab_hv_style_indic, 0); lv_style_set_bg_opa(&tab_hv_style_indic, LV_OPA_COVER); lv_style_set_bg_color(&tab_hv_style_indic, lv_palette_main(LV_PALETTE_BLUE)); + // Gradient makes performances much worse // lv_style_set_bg_grad_color(&tab_hv_style_indic, lv_palette_main(LV_PALETTE_RED)); // lv_style_set_bg_grad_dir(&tab_hv_style_indic, LV_GRAD_DIR_HOR); @@ -276,6 +277,7 @@ void init_hv_styles(void) { lv_style_set_radius(&tab_hv_style_precharge, 0); lv_style_set_bg_opa(&tab_hv_style_precharge, LV_OPA_COVER); lv_style_set_bg_color(&tab_hv_style_precharge, lv_palette_main(LV_PALETTE_YELLOW)); + // Gradient makes performances much worse // lv_style_set_bg_grad_color(&tab_hv_style_precharge, lv_palette_main(LV_PALETTE_RED)); // lv_style_set_bg_grad_dir(&tab_hv_style_precharge, LV_GRAD_DIR_HOR); diff --git a/Core/UI/steering/racing_tabs/tab_lv.c b/Core/UI/steering/racing_tabs/tab_lv.c index 662d6583..ad549a37 100644 --- a/Core/UI/steering/racing_tabs/tab_lv.c +++ b/Core/UI/steering/racing_tabs/tab_lv.c @@ -54,6 +54,7 @@ void init_lv_styles(void) { lv_style_set_radius(&tab_lv_style_indic_pumps, 0); lv_style_set_bg_opa(&tab_lv_style_indic_pumps, LV_OPA_COVER); lv_style_set_bg_color(&tab_lv_style_indic_pumps, lv_palette_main(LV_PALETTE_BLUE)); + // Gradient makes performances much worse // lv_style_set_bg_grad_color(&tab_lv_style_indic_pumps, lv_palette_main(LV_PALETTE_RED)); // lv_style_set_bg_grad_dir(&tab_lv_style_indic_pumps, LV_GRAD_DIR_VER); @@ -61,6 +62,7 @@ void init_lv_styles(void) { lv_style_set_radius(&tab_lv_style_indic_radiators, 0); lv_style_set_bg_opa(&tab_lv_style_indic_radiators, LV_OPA_COVER); lv_style_set_bg_color(&tab_lv_style_indic_radiators, lv_palette_main(LV_PALETTE_BLUE)); + // Gradient makes performances much worse // lv_style_set_bg_grad_color(&tab_lv_style_indic_radiators, lv_palette_main(LV_PALETTE_RED)); // lv_style_set_bg_grad_dir(&tab_lv_style_indic_radiators, LV_GRAD_DIR_VER); diff --git a/Core/UI/steering/steering.c b/Core/UI/steering/steering.c index 06766a08..3042e304 100644 --- a/Core/UI/steering/steering.c +++ b/Core/UI/steering/steering.c @@ -98,6 +98,13 @@ void car_status_update(bool valid) { set_tab_track_test_lb_speed("ENINV"); break; } + case primary_ecu_status_status_re_enable_inverter_drive: { + precharge_bar_popup_hide(); + set_tab_racing_label_text("-", tab_rac_bottom_status_idx); + set_tab_racing_label_text("REINV", tab_rac_status_idx); + set_tab_track_test_lb_speed("REINV"); + break; + } case primary_ecu_status_status_drive: { precharge_bar_popup_hide(); set_tab_racing_label_text("km/h", tab_rac_bottom_status_idx); @@ -121,8 +128,6 @@ void car_status_update(bool valid) { set_tab_track_test_lb_speed("FATAL"); break; } - default: - break; } } @@ -178,6 +183,7 @@ void vehicle_speed_update(bool valid) { snprintf(snprintf_buffer, SNPRINTF_BUFFER_SIZE, NOT_AVAILABLE_STRING_LABEL); set_tab_racing_label_text(snprintf_buffer, tab_rac_status_idx); set_tab_track_test_lb_speed(snprintf_buffer); + return; } if (primary_ecu_status_last_state->status != primary_ecu_status_status_drive) { @@ -819,48 +825,33 @@ void canlib_versions_mismatch_checker() { } void ecu_version_update(bool valid) { - if (valid) { - was_received_ecu_version = true; - canlib_versions_mismatch_checker(); - } else { - return; - } + if (!valid) return; + was_received_ecu_version = true; + canlib_versions_mismatch_checker(); } void lv_version_update(bool valid) { - if (valid) { - was_received_lv_version = true; - canlib_versions_mismatch_checker(); - } else { - return; - } + if (!valid) return; + was_received_lv_version = true; + canlib_versions_mismatch_checker(); } void hv_cellboard_version_update(bool valid) { - if (valid) { - was_received_hv_cellboard_version = true; - canlib_versions_mismatch_checker(); - } else { - return; - } + if (!valid) return; + was_received_hv_cellboard_version = true; + canlib_versions_mismatch_checker(); } void hv_mainboard_version_update(bool valid) { - if (valid) { - was_received_hv_mainboard_version = true; - canlib_versions_mismatch_checker(); - } else { - return; - } + if (!valid) return; + was_received_hv_mainboard_version = true; + canlib_versions_mismatch_checker(); } void tlm_version_update(bool valid) { - if (valid) { - was_received_tlm_version = true; - canlib_versions_mismatch_checker(); - } else { - return; - } + if (!valid) return; + was_received_tlm_version = true; + canlib_versions_mismatch_checker(); } void steer_angle_update(bool valid) { diff --git a/Core/UI/steering/steering_config.h b/Core/UI/steering/steering_config.h index fe2bf884..6e37b92d 100644 --- a/Core/UI/steering/steering_config.h +++ b/Core/UI/steering/steering_config.h @@ -15,6 +15,7 @@ #include // #define PERIODIC_SET_ECU_POWER_MAPS +#define PRECHARGE_BAR_ENABLED (0U) /**** * If this is enabled, when changing tabs clears memory of past messages. diff --git a/Core/UI/steering/tab_manager.c b/Core/UI/steering/tab_manager.c index 6e80d361..b51fd1a7 100644 --- a/Core/UI/steering/tab_manager.c +++ b/Core/UI/steering/tab_manager.c @@ -303,19 +303,21 @@ bool is_on_help_animation(void) { static bool on_precharge_bar_popup = false; void precharge_bar_popup_show() { - return; +#if PRECHARGE_BAR_ENABLED == 1 if (!on_precharge_bar_popup) { on_precharge_bar_popup = true; lv_scr_load(tab_precharge_popup_ptr); } +#endif } void precharge_bar_popup_hide() { - return; +#if PRECHARGE_BAR_ENABLED == 1 if (on_precharge_bar_popup) { on_precharge_bar_popup = false; restore_previous_screen(NULL); } +#endif } void display_notification(const char *label_content, uint32_t timeout_ms, uint32_t background_color_hex, uint32_t label_color_hex) {