Переглянути джерело

fix get charger cycle

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 роки тому
батько
коміт
376075113c

+ 1 - 1
Application/app/bms_message.c

@@ -145,7 +145,7 @@ void process_bms_message(can_frame_t *frame, int len){
 			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_totol = get_soc()->total_coulomb;
+			soc.c_totol = soc_get_cycle();
 			data = (uint8_t *)&soc;
 			data_len = sizeof(soc);
 			protocol_send_bms_info(frame->head.can_addr, frame->key, data, data_len);

+ 4 - 2
Application/app/protocol_old.c

@@ -87,8 +87,10 @@ static int get_response_data(uint8_t *data, uint8_t operate, uint8_t result){
 		strcpy((char *)&data[head->size], bsp_get_fversion());
 		head->size += strlen(bsp_get_fversion());
 	}else if (operate == OP_ALARM_TIMES){
-		memset(&data[head->size], 0, 42);
-		head->size += 42;
+		memset(&data[head->size], 0, sizeof(times_response_t));
+		times_response_t *resp = (times_response_t *)&data[head->size];
+		resp->charger_cycle = soc_get_cycle();
+		head->size += sizeof(times_response_t);
 	}else if (operate == OP_CELL_VOL){
 		data[head->size ++] = CELLS_NUM;
 		for (int i = 0; i <CELLS_NUM; i++){

+ 9 - 0
Application/app/protocol_old.h

@@ -40,6 +40,15 @@ typedef struct
 }comm_response_t;
 #pragma pack(pop)
 
+#pragma  pack (push,1)  
+typedef struct
+{
+	uint8_t res1[2];
+	uint32_t charger_cycle;
+	uint8_t res2[36];
+}times_response_t;
+#pragma pack(pop)
+
 
 enum
 {