Explorar o código

解决能量为负,导致剩余里程不准的问题

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui %!s(int64=4) %!d(string=hai) anos
pai
achega
bfaafb2c1c
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      Application/app/bms_message.c

+ 5 - 1
Application/app/bms_message.c

@@ -69,7 +69,11 @@ void process_bms_message(can_frame_t *frame, int len){
 		case CAN_KEY_BMS_BASE_INFO:{
 			binfo_cmd_resp_t bresp;
 			bresp.capacity = get_soc()->capacity;
-			bresp.energy = get_soc()->coulomb_now - get_soc()->coulomb_min;
+			if (get_soc()->coulomb_now >= get_soc()->coulomb_min) {
+				bresp.energy = get_soc()->coulomb_now - get_soc()->coulomb_min;
+			}else{
+				bresp.energy = 0;
+			}
 			bresp.pack_current = measure_value()->load_current;
 			bresp.pack_voltage = bms_state_get()->pack_voltage;
 			bresp.max_temp = -100;