You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

#pragma once
#include <stdint.h>
namespace iflytop {
namespace err {
using namespace std;
#define ERROR_CODE(errortype, suberrorcode) (errortype + suberrorcode)
typedef enum {
ksucc = ERROR_CODE(0, 0),
kfail = ERROR_CODE(0, 1),
kstep_motor_not_found_zero_point = ERROR_CODE(600, 0), // 未找到零点
kstep_motor_not_go_zero = ERROR_CODE(600, 1), // 设备未归零
kstep_motor_over_temperature = ERROR_CODE(600, 2), // 过温
kstep_motor_over_voltage = ERROR_CODE(600, 3), // 过压
kstep_motor_run_overtime = ERROR_CODE(600, 4), // 运行超时
kstep_motor_not_enable = ERROR_CODE(600, 5), // 电机未使能
kstep_motor_ioindex_out_of_range = ERROR_CODE(600, 6), // IO超出范围
kstep_motor_subic_reset = ERROR_CODE(600, 7), // 子IC复位
kstep_motor_drv_err = ERROR_CODE(600, 8), // 驱动器异常
kstep_motor_uv_cp = ERROR_CODE(600, 9), // 驱动器异常
kstep_motor_not_found_point_edge = ERROR_CODE(600, 10), // 未找到零点
} error_t;
typedef struct {
int index;
const char* info;
} ecode_table_item_t;
const char* error2str(int32_t code);
ecode_table_item_t* error_get_table();
int error_get_table_size();
} // namespace err
} // namespace iflytop