Skip to content

Commit

Permalink
update canlib and fix lvgl crashes
Browse files Browse the repository at this point in the history
desburing, cit. E.Advisor
  • Loading branch information
gmazzucchi committed Aug 12, 2024
1 parent eae3c9e commit b52b3e5
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Core/Lib/lvgl-stm32/lvgl
Submodule lvgl updated from df9596 to c99a5f
1 change: 1 addition & 0 deletions Core/UI/steering/controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Core/UI/steering/racing_tabs/precharge_bar_popup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions Core/UI/steering/racing_tabs/tab_hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,15 @@ 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);

lv_style_init(&tab_hv_style_precharge);
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);

Expand Down
2 changes: 2 additions & 0 deletions Core/UI/steering/racing_tabs/tab_lv.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ 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);

lv_style_init(&tab_lv_style_indic_radiators);
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);

Expand Down
55 changes: 23 additions & 32 deletions Core/UI/steering/steering.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -121,8 +128,6 @@ void car_status_update(bool valid) {
set_tab_track_test_lb_speed("FATAL");
break;
}
default:
break;
}
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions Core/UI/steering/steering_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdint.h>

// #define PERIODIC_SET_ECU_POWER_MAPS
#define PRECHARGE_BAR_ENABLED (0U)

/****
* If this is enabled, when changing tabs clears memory of past messages.
Expand Down
6 changes: 4 additions & 2 deletions Core/UI/steering/tab_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b52b3e5

Please sign in to comment.