ソースを参照

Merge remote-tracking branch 'origin/master' into balance

huhui 4 年 前
コミット
d234db62ca
3 ファイル変更17 行追加6 行削除
  1. 4 0
      Application/app/event_record.h
  2. 10 2
      Application/app/sox/health.c
  3. 3 4
      Application/app/sox/soc.c

+ 4 - 0
Application/app/event_record.h

@@ -20,6 +20,10 @@ typedef enum {
 	Temp_Changed,
 	Charger_Full_cap,
 	Max_current_persis,
+	Pack_Temp,
+	Charger_Full_cap2,
+	Cell_Under_Vol2,
+	Cell_Over_Vol2,
 }event_id_t;
 
 typedef struct {

+ 10 - 2
Application/app/sox/health.c

@@ -273,6 +273,14 @@ static void push_cell_event(event_id_t id){
 	u32 min = ((bms_state_get()->cell_index_of_min_vol << 12) & 0xF000) | (min_v & 0x0FFF);
 
 	push_event(id, max << 16 | min);
+
+	u32 temps = 0;
+	s8  onetemp = 0;
+	for (int i = 0; i < PACK_TEMPS_NUM; i++){		
+		onetemp = (s8)measure_value()->pack_temp[i];
+		temps |= (onetemp << i) & (0xFF<<i);
+	}
+	push_event(Pack_Temp, temps);
 }
 
 void check_voltage_state(void) {
@@ -292,7 +300,7 @@ void check_voltage_state(void) {
 		if ((bms_state_get()->cell_max_vol>= SIGLE_CELL_MAX_CHARGER_VOLTAGE)){
 			if (judge_debounce(!_health.sigle_cell_over_voltage, &_sigle_cell_charger_max_vol)){
 				_health.sigle_cell_over_voltage = 1;
-				push_cell_event(Cell_Over_Vol);
+				push_cell_event(Cell_Over_Vol2);
 				sys_debug("sigle cell %d\n", bms_state_get()->cell_max_vol);
 			}
 		}else if ((bms_state_get()->cell_max_vol < SIGLE_CELL_MAX_CHARGER_VOLTAGE)){
@@ -308,7 +316,7 @@ void check_voltage_state(void) {
 		if ((bms_state_get()->cell_min_vol <= min_discharger_cell_vol[_health.is_work_temp_normal])){
 			if (judge_debounce(!_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
 				_health.sigle_cell_lower_voltage = 1;
-				push_cell_event(Cell_Under_Vol);
+				push_cell_event(Cell_Under_Vol2);
 				_single_low_judge_current(true);
 				error_counts.cell_under_voltage++;
 			}

+ 3 - 4
Application/app/sox/soc.c

@@ -313,8 +313,8 @@ static void _force_capacity_full(void){
 	is_force_full = true;
 	force_full_time = shark_get_seconds();
 	double curr_real_cap = start_charger_coulomb + _soc.charger_coulomb;
+	double curr_min_cap = 0.0f;
 	if (can_modify_min_when_full()) { //前面出现过电芯欠压, 当前容量没到最大容量
-		double curr_min_cap = 0.0f;
 		if (curr_real_cap > _soc.coulomb_max) {
 			curr_min_cap = _soc.coulomb_min - (curr_real_cap - _soc.coulomb_max);
 		}else {
@@ -326,12 +326,11 @@ static void _force_capacity_full(void){
 		//don't trust if curr_min_cap big than before
 		if (curr_min_cap < _soc.coulomb_min) {
 			_soc.coulomb_min = _soc.coulomb_min * (1.0f - min_cap_lfp) + curr_min_cap * min_cap_lfp; //lowpass filter
-			soc_warning("current real cap %f\n", _soc.coulomb_min);
-			push_event(Min_Cap_For_Full, (u32)curr_min_cap);
 		}
 	}
 	u32 cap_x10 = (u32)(curr_real_cap / 3600.0f * 10);
-	push_event(Charger_Full_cap, (bms_state_get()->pack_voltage << 16) | (cap_x10 & 0xFFFF));
+	u32 min_x10 = (u32)(curr_min_cap / 3600.0f * 10);
+	push_event(Charger_Full_cap2, ((min_x10 & 0xFFFF) << 16) | (cap_x10 & 0xFFFF));
 	_soc.coulomb_now = _soc.coulomb_max;//充满后,当前容量设置为最大容量
 
 	force_full_ts = shark_get_seconds();