diff --git a/iflytop_canbus_protocol.hpp b/iflytop_canbus_protocol.hpp index 6cc1add..39183a1 100644 --- a/iflytop_canbus_protocol.hpp +++ b/iflytop_canbus_protocol.hpp @@ -1,7 +1,8 @@ #pragma once #include -#define PROTOCOL_VERSION 1 +#define PROTOCOL_VERSION 1 +#define HEART_PACKET_PERIOD_MS (5 * 1000) extern "C" { #pragma pack(1) @@ -67,7 +68,7 @@ typedef enum { } ErrorCode_t; -static const char *ErrorCodeToString(uint32_t code) { +static inline const char *ErrorCodeToString(uint32_t code) { switch (code) { case kerr_noerror: return "no error"; @@ -94,6 +95,7 @@ typedef enum { * 板子基本操作 * ***********************************************************************************************************************/ kcmd_read_board_info = 1, // cmd:no, ack:read_board_info_ack_t + kcmd_force_report = 2, // cmd:no, ack:read_board_info_ack_t kreport_heatpacket = 50, // cmd:no ack:no report:heatpacket_t kreport_exception_error = 51, // report:error_code,subid @@ -232,16 +234,14 @@ typedef enum { } cmd_t; -#define HEART_OVERTIME_MS (10 * 1000) - #pragma pack(1) /*********************************************************************************************************************** * ACK * ***********************************************************************************************************************/ typedef struct { - uint8_t boardType; - uint8_t projectId; + uint16_t boardType; + uint16_t projectId; uint16_t protcol_version; uint16_t software_version; uint16_t hardware_version;