diff --git a/iflytop_canbus_protocol.hpp b/iflytop_canbus_protocol.hpp index 23e33d0..9a174ac 100644 --- a/iflytop_canbus_protocol.hpp +++ b/iflytop_canbus_protocol.hpp @@ -2,6 +2,7 @@ #include #define PROTOCOL_VERSION 1 +#define HEART_OVERTIME_MS (10 * 1000) extern "C" { #pragma pack(1) @@ -53,7 +54,7 @@ typedef enum { } ProjectID_t; typedef enum { - kerr_noerror = 0, + kerr_noerror = 0, kerr_overtime = 1, // 驱动器错误 @@ -67,8 +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"; @@ -95,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 @@ -233,7 +234,7 @@ typedef enum { } cmd_t; -#define HEART_OVERTIME_MS (10 * 1000) + #pragma pack(1) @@ -241,8 +242,8 @@ typedef enum { * 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;