浏览代码

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

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 4 年之前
父节点
当前提交
bfaafb2c1c
共有 1 个文件被更改,包括 5 次插入1 次删除
  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;