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.

71 lines
3.6 KiB

1 year ago
  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. /***********************************************************************************************************************
  11. * *
  12. ***********************************************************************************************************************/
  13. kparam_out_of_range = ERROR_CODE(100, 2), // 参数超出范围
  14. kcmd_not_support = ERROR_CODE(100, 3), // 操作不支持
  15. kdevice_is_busy = ERROR_CODE(100, 4), // 设备忙
  16. kdevice_is_offline = ERROR_CODE(100, 5), // 设备离线
  17. kovertime = ERROR_CODE(100, 6),
  18. knoack = ERROR_CODE(100, 7),
  19. kerrorack = ERROR_CODE(100, 8),
  20. kdevice_offline = ERROR_CODE(100, 9),
  21. ksubdevice_overtime = ERROR_CODE(100, 11),
  22. kbuffer_not_enough = ERROR_CODE(100, 12),
  23. kcmd_param_num_error = ERROR_CODE(100, 14),
  24. kcheckcode_is_error = ERROR_CODE(100, 15),
  25. /***********************************************************************************************************************
  26. * *
  27. ***********************************************************************************************************************/
  28. kmodule_opeation_break_by_user = ERROR_CODE(200, 2), // 用户中断
  29. kmodule_not_find_reg = ERROR_CODE(200, 7), // 未找到配置索引
  30. /***********************************************************************************************************************
  31. * *
  32. ***********************************************************************************************************************/
  33. kstep_motor_not_found_zero_point = ERROR_CODE(600, 0), // 未找到零点
  34. kstep_motor_not_go_zero = ERROR_CODE(600, 1), // 设备未归零
  35. kstep_motor_over_temperature = ERROR_CODE(600, 2), // 过温
  36. kstep_motor_over_voltage = ERROR_CODE(600, 3), // 过压
  37. kstep_motor_run_overtime = ERROR_CODE(600, 4), // 运行超时
  38. kstep_motor_not_enable = ERROR_CODE(600, 5), // 电机未使能
  39. kstep_motor_ioindex_out_of_range = ERROR_CODE(600, 6), // IO超出范围
  40. kstep_motor_subic_reset = ERROR_CODE(600, 7), // 子IC复位
  41. kstep_motor_drv_err = ERROR_CODE(600, 8), // 驱动器异常
  42. kstep_motor_uv_cp = ERROR_CODE(600, 9), // 驱动器异常
  43. kstep_motor_not_found_point_edge = ERROR_CODE(600, 10), // 未找到零点
  44. /***********************************************************************************************************************
  45. * *
  46. ***********************************************************************************************************************/
  47. kmini_servo_not_enable = ERROR_CODE(700, 0), //
  48. kmini_servo_mode_not_support = ERROR_CODE(700, 1), //
  49. } error_t;
  50. typedef struct {
  51. int index;
  52. const char* info;
  53. } ecode_table_item_t;
  54. const char* error2str(int32_t code);
  55. ecode_table_item_t* error_get_table();
  56. int error_get_table_size();
  57. } // namespace err
  58. } // namespace iflytop