|
|
@ -6,6 +6,20 @@ |
|
|
|
extern "C" { |
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 消息格式 12bit from,1bit emergency |
|
|
|
* |
|
|
|
* [1] [4bit] [8bit] [8bit] [4bit/4bit] |
|
|
|
* , from to frameNum/frameId |
|
|
|
*/ |
|
|
|
|
|
|
|
typedef struct { |
|
|
|
uint8_t pad; |
|
|
|
uint8_t from; |
|
|
|
uint8_t to; |
|
|
|
uint8_t frameNumAndFrameId; |
|
|
|
} zcanid_t; |
|
|
|
|
|
|
|
typedef struct { |
|
|
|
uint8_t ptype; |
|
|
|
uint8_t index; |
|
|
@ -20,7 +34,6 @@ typedef enum { |
|
|
|
kreceipt, |
|
|
|
kerror_receipt, |
|
|
|
kreport, |
|
|
|
kheat, // 心跳
|
|
|
|
} packet_type_t; |
|
|
|
|
|
|
|
typedef enum { |
|
|
@ -41,6 +54,7 @@ typedef enum { |
|
|
|
|
|
|
|
typedef enum { |
|
|
|
kerr_noerror = 0, |
|
|
|
kerr_overtime = 1, |
|
|
|
|
|
|
|
// 驱动器错误
|
|
|
|
kerr_motorReset = 100, |
|
|
@ -53,6 +67,28 @@ typedef enum { |
|
|
|
|
|
|
|
} ErrorCode_t; |
|
|
|
|
|
|
|
|
|
|
|
static const char *ErrorCodeToString(uint32_t code) { |
|
|
|
switch (code) { |
|
|
|
case kerr_noerror: |
|
|
|
return "no error"; |
|
|
|
case kerr_motorReset: |
|
|
|
return "motor reset"; |
|
|
|
case kerr_motorUnkownError: |
|
|
|
return "motor unkown error"; |
|
|
|
case kerr_AirBlowerError: |
|
|
|
return "air blower error"; |
|
|
|
case kerr_HeaterError: |
|
|
|
return "heater error"; |
|
|
|
case kerr_BlowerError: |
|
|
|
return "blower error"; |
|
|
|
case kerr_ProportionalValveError: |
|
|
|
return "proportional valve error"; |
|
|
|
default: |
|
|
|
return "unkown error"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
typedef enum { |
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
|