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.

39 lines
1.3 KiB

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