Explorar o código

add key for get bms timestamp

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

+ 6 - 0
Application/app/bms_message.c

@@ -76,6 +76,12 @@ void process_bms_message(can_frame_t *frame, int len){
 			bms_insert = 0;
 			protocol_send_ack(frame->head.can_addr, frame->key, result);
 			break;
+		case CAN_KEY_BMS_GET_TIME:{
+			uint32_t time = shark_get_seconds();
+			data = (uint8_t *)&time;
+			data_len = sizeof(time);
+			break;
+		}
 		case CAN_KEY_BMS_GET_STAT: {
 			stat_cmd_resp_t sresp;
 			sresp.insert = bms_insert;

+ 1 - 1
Application/app/protocol.h

@@ -89,7 +89,7 @@ typedef struct {
 #define CAN_KEY_SET_LOGGER  0xa2 //byte 0:modle, byte1 level
 #define CAN_KEY_BMS_CLEAR   0xa3 //clear some flags used by PSxxx, exp: stat_cmd_resp_t.insert
 #define CAN_KEY_BMS_GET_HEALTH_STAT 0xa4 //return bms_health_t
-
+#define CAN_KEY_BMS_GET_TIME      0xa5 //return bms running times(second) uint32_t
 #define CAN_KEY_GET_VERSION 0x0c //return string
 #define CAN_KEY_SET_SN      0x06 //string
 #define CAN_KEY_GET_SN      0x05 //return string