Преглед изворни кода

加入均衡次数的计数

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui пре 4 година
родитељ
комит
aa8124c4b0
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      Application/app/sox/state.c

+ 4 - 2
Application/app/sox/state.c

@@ -48,7 +48,7 @@ static int no_hall_count = 0;
 u64 uart_frame_time = 0;
 static u32 uart_reinit_count = 0;
 static u32 pd_count = 0;
-
+static u32 cell_balance_count = 0;
 static void put_no_hall_time(void){
 	no_hall_time[no_hall_count] = shark_get_seconds();
 	no_hall_count = (no_hall_count + 1) % 5;
@@ -136,6 +136,7 @@ void bms_state_log(void){
 	state_debug("Reset Reson 0x%x, 0x%x\n", bsp_get_rst_reson(), pd_count);
 	state_debug("BackUp value 0x%x\n", bsp_get_backup());
 	state_debug("Debug: %d, %d. uart reinit=%d\n", shark_uart_timeout(), io_state()->hall_detect, uart_reinit_count);
+	state_debug("Cell balance count %d\n", cell_balance_count);
 	log_no_hall_time();
 #if 0
 	state_debug("Charging: %d\n", _bms_state.charging);
@@ -143,7 +144,7 @@ void bms_state_log(void){
 	state_debug("DMos: %d\n", ml5238_is_discharging());
 	state_debug("CMos: %d\n", ml5238_is_charging());
 	state_debug("AuxPower: %d\n", AUX_VOL_IS_OPEN());
-	state_debug("WorkMode:0x%x\n", _bms_state.work_mode);l
+	state_debug("WorkMode:0x%x\n", _bms_state.work_mode);
 #endif
 }
 
@@ -655,6 +656,7 @@ static void check_cell_balance(uint8_t current_max_index){
 	}
 	if (!_bms_state.pack_balancing && debounce_reach_max(_cell_balance)){
 		_bms_state.pack_balancing = 1;
+		cell_balance_count ++;
 		ml5238_cell_start_balance(get_balance_mask(current_max_index));
 		shark_timer_post(&_balance_timer, 30 * 1000); //stop balance after 30s
 		debounce_reset(_cell_balance);