Explorar o código

读取soc提高精度

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

+ 5 - 5
Application/app/bms_message.c

@@ -150,11 +150,11 @@ void process_bms_message(can_frame_t *frame, int len){
 		}
 		case CAN_KEY_GET_SOC_INFO: {
 			soc_info_t soc;
-			soc.c_min = get_soc()->coulomb_min/36.0f;
-			soc.c_max = get_soc()->coulomb_max/36.0f;
-			soc.c_now = get_soc()->coulomb_now/36.0f;
-			soc.c_discharger = get_soc()->dischrger_coulomb/36.0f;
-			soc.c_charger = get_soc()->charger_coulomb/36.0f;
+			soc.c_min = get_soc()->coulomb_min;
+			soc.c_max = get_soc()->coulomb_max;
+			soc.c_now = get_soc()->coulomb_now;
+			soc.c_discharger = get_soc()->dischrger_coulomb;
+			soc.c_charger = get_soc()->charger_coulomb;
 			soc.cycle = soc_get_cycle();
 			soc.calibrated = (get_soc()->flags & SOC_FLAG_CALIBRATED) != 0;			
 			data = (uint8_t *)&soc;

+ 6 - 6
Application/app/protocol.h

@@ -106,13 +106,13 @@ typedef struct {
 
 #define CAN_KEY_GET_SOC_INFO 0xa7
 typedef struct {
-	int c_min;
-	int c_max;
-	int c_now;
-	int c_charger;
-	int c_discharger;
+	uint32_t c_min;
+	uint32_t c_max;
+	uint32_t c_now;
+	uint32_t c_charger;
+	uint32_t c_discharger;
 	uint32_t cycle; //³ä·ÅµçÑ­»·´ÎÊý
-	uint32_t  calibrated;	
+	uint32_t calibrated;	
 }soc_info_t;
 
 #define CAN_KEY_BMS_TEMPS 0x11 //return int[4]