11#include "FEB_CAN_BMS.h"
22#include "FEB_CAN_PCU.h"
3+ #include "FEB_CAN_LVPDB.h"
34#include "lvgl.h"
45#include "src/core/lv_obj.h"
56#include "src/core/lv_obj_style.h"
1314static lv_obj_t * ui_BMS_State_String ;
1415static lv_obj_t * ui_BMS_Cell_Max_Temperature ;
1516static lv_obj_t * ui_BMS_Accumulator_Total_Voltage ;
17+ static lv_obj_t * ui_BMS_HV_State_String ;
18+ static lv_obj_t * ui_LVPDB_low_voltage ;
1619
1720int16_t cell_max_temperature = 67 ;
1821uint16_t accumulator_total_voltage = 67 ;
22+ uint16_t low_voltage = 67 ;
1923
2024char buf [16 ];
2125
2226void FEB_UI_Update_BMS_State ()
2327{
2428 BMS_State_t state = FEB_CAN_BMS_GetLastState ();
2529 lv_label_set_text (ui_BMS_State_String , to_BMS_state_string (state ));
30+ lv_label_set_text (ui_BMS_HV_State_String , (FEB_CAN_BMS_GetLastHVState () ? "HV_ON" : "HV_OFF" ));
2631
2732 cell_max_temperature = FEB_CAN_BMS_GetLastCellMaxTemperature ();
2833 accumulator_total_voltage = FEB_CAN_BMS_GetLastAccumulatorTotalVoltage ();
34+ low_voltage = FEB_CAN_LVPDB_GetLast24VVoltage ();
2935
3036 snprintf (buf , sizeof (buf ), "%d.%d °C" , cell_max_temperature / 10 , cell_max_temperature % 10 );
3137 lv_label_set_text (ui_BMS_Cell_Max_Temperature , buf );
3238
39+ snprintf (buf , sizeof (buf ), "%d.%d V" , low_voltage / 10 , low_voltage % 10 );
40+ lv_label_set_text (ui_LVPDB_low_voltage , buf );
41+
3342 snprintf (buf , sizeof (buf ), "%d.%d V" , accumulator_total_voltage / 10 , accumulator_total_voltage % 10 );
3443 lv_label_set_text (ui_BMS_Accumulator_Total_Voltage , buf );
3544}
@@ -42,6 +51,12 @@ void FEB_UI_Init_BMS_State(lv_obj_t *ui_Screen)
4251 lv_obj_set_style_text_font (ui_BMS_State_String , & lv_font_montserrat_40 , 0 );
4352 lv_obj_set_style_text_color (ui_BMS_State_String , lv_color_hex (0xFFFFFF ), 0 );
4453
54+ ui_BMS_HV_State_String = lv_label_create (ui_Screen );
55+ lv_obj_align (ui_BMS_HV_State_String , LV_ALIGN_BOTTOM_RIGHT , -15 , -35 );
56+ lv_label_set_text (ui_BMS_HV_State_String , "---" );
57+ lv_obj_set_style_text_font (ui_BMS_HV_State_String , & lv_font_montserrat_40 , 0 );
58+ lv_obj_set_style_text_color (ui_BMS_HV_State_String , lv_color_hex (0xFFFFFF ), 0 );
59+
4560 ui_BMS_Cell_Max_Temperature = lv_label_create (ui_Screen );
4661 lv_obj_align (ui_BMS_Cell_Max_Temperature , LV_ALIGN_TOP_LEFT , 15 , 60 );
4762 lv_label_set_text (ui_BMS_Cell_Max_Temperature , "--.- °C" );
@@ -53,13 +68,21 @@ void FEB_UI_Init_BMS_State(lv_obj_t *ui_Screen)
5368 lv_label_set_text (ui_BMS_Accumulator_Total_Voltage , "---.- V" );
5469 lv_obj_set_style_text_font (ui_BMS_Accumulator_Total_Voltage , & lv_font_montserrat_40 , 0 );
5570 lv_obj_set_style_text_color (ui_BMS_Accumulator_Total_Voltage , lv_color_hex (0xFFFFFF ), 0 );
71+
72+ ui_LVPDB_low_voltage = lv_label_create (ui_Screen );
73+ lv_obj_align (ui_LVPDB_low_voltage , LV_ALIGN_TOP_RIGHT , -15 , 40 );
74+ lv_label_set_text (ui_LVPDB_low_voltage , "--.- V" );
75+ lv_obj_set_style_text_font (ui_LVPDB_low_voltage , & lv_font_montserrat_40 , 0 );
76+ lv_obj_set_style_text_color (ui_LVPDB_low_voltage , lv_color_hex (0xFFFFFF ), 0 );
5677}
5778
5879void FEB_UI_Destroy_BMS_State (void )
5980{
6081 ui_BMS_State_String = NULL ;
82+ ui_BMS_HV_State_String = NULL ;
6183 ui_BMS_Cell_Max_Temperature = NULL ;
6284 ui_BMS_Accumulator_Total_Voltage = NULL ;
85+ ui_LVPDB_low_voltage = NULL ;
6386}
6487
6588char * to_BMS_state_string (BMS_State_t state )
0 commit comments