|
@@ -24,7 +24,7 @@ static u32 _bms_main_task_handler(void);
|
|
|
static void _debug_timer_handler(shark_timer_t *t);
|
|
static void _debug_timer_handler(shark_timer_t *t);
|
|
|
|
|
|
|
|
static bms_state_t _bms_state;
|
|
static bms_state_t _bms_state;
|
|
|
-static int8_t pcb_temp = 100;
|
|
|
|
|
|
|
+static int pcb_temp = 100;
|
|
|
static int pcb_temp_count = 0;
|
|
static int pcb_temp_count = 0;
|
|
|
static int ml5238_cali_count = 0;
|
|
static int ml5238_cali_count = 0;
|
|
|
static shark_task_t _bms_main_task = {.handler = _bms_main_task_handler};
|
|
static shark_task_t _bms_main_task = {.handler = _bms_main_task_handler};
|
|
@@ -515,11 +515,12 @@ static void _voltage_notify(void){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void _temperature_notify(void){
|
|
static void _temperature_notify(void){
|
|
|
- if (abs(pcb_temp - measure_value()->pack_temp[PCB_TEMP_INDEX]) >= 5){//pcb温度变化超过5度,需要重新校准ML5238
|
|
|
|
|
|
|
+ int pcb_current_temp = measure_value()->pack_temp[PCB_TEMP_INDEX];
|
|
|
|
|
+ if (abs(pcb_temp - pcb_current_temp) >= 5){//pcb温度变化超过5度,需要重新校准ML5238
|
|
|
if (pcb_temp_count ++ >= 5) {
|
|
if (pcb_temp_count ++ >= 5) {
|
|
|
current_calibrate();
|
|
current_calibrate();
|
|
|
- pcb_temp = measure_value()->pack_temp[PCB_TEMP_INDEX];
|
|
|
|
|
- state_warning("ML5238 calibrate!!\n");
|
|
|
|
|
|
|
+ state_warning("ML5238 calibrate, %d -> %d!!\n", pcb_temp, pcb_current_temp);
|
|
|
|
|
+ pcb_temp = pcb_current_temp;
|
|
|
pcb_temp_count = 0;
|
|
pcb_temp_count = 0;
|
|
|
ml5238_cali_count ++;
|
|
ml5238_cali_count ++;
|
|
|
}
|
|
}
|