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.

103 lines
3.4 KiB

#include "errorcode.hpp"
#define ERR2STR(code) \
case code: \
return #code;
namespace iflytop {
namespace err {
#define ERR_ITERM(enum) \
{ enum, #enum }
static ecode_table_item_t table[] = {
ERR_ITERM(ksucc),
ERR_ITERM(kfail),
ERR_ITERM(kparam_out_of_range),
ERR_ITERM(kcmd_not_support),
ERR_ITERM(kdevice_is_busy),
ERR_ITERM(kdevice_is_offline),
ERR_ITERM(kovertime),
ERR_ITERM(knoack),
ERR_ITERM(kerrorack),
ERR_ITERM(kdevice_offline),
ERR_ITERM(ksubdevice_overtime),
ERR_ITERM(kbuffer_not_enough),
ERR_ITERM(kcmd_param_num_error),
ERR_ITERM(kcheckcode_is_error),
ERR_ITERM(killegal_operation),
ERR_ITERM(kaction_overtime),
ERR_ITERM(kmodule_opeation_break_by_user),
ERR_ITERM(kmodule_not_find_reg),
ERR_ITERM(kxymotor_x_find_zero_edge_fail),
ERR_ITERM(kxymotor_y_find_zero_edge_fail),
ERR_ITERM(kxymotor_not_enable),
ERR_ITERM(kxymotor_target_pos_outof_range),
ERR_ITERM(kxymotor_not_move_to_zero),
ERR_ITERM(kpipette_error_NoError),
ERR_ITERM(kpipette_error_InitFail),
ERR_ITERM(kpipette_error_InvalidCmd),
ERR_ITERM(kpipette_error_InvalidArg),
ERR_ITERM(kpipette_error_PressureSensorError),
ERR_ITERM(kpipette_error_OverPressure),
ERR_ITERM(kpipette_error_LLDError),
ERR_ITERM(kpipette_error_DeviceNotInit),
ERR_ITERM(kpipette_error_TipPopError),
ERR_ITERM(kpipette_error_PumpOverload),
ERR_ITERM(kpipette_error_TipDrop),
ERR_ITERM(kpipette_error_CanBusError),
ERR_ITERM(kpipette_error_InvalidChecksum),
ERR_ITERM(kpipette_error_EEPROMError),
ERR_ITERM(kpipette_error_CmdBufferEmpty),
ERR_ITERM(kpipette_error_CmdBufferOverflow),
ERR_ITERM(kpipette_error_TipBlock),
ERR_ITERM(kpipette_error_AirSuction),
ERR_ITERM(kpipette_error_Bubble),
ERR_ITERM(kpipette_error_VolumeError),
ERR_ITERM(kpipette_error_TipAlreadyLoad),
ERR_ITERM(kpipette_error_TipLoadFail),
ERR_ITERM(kpipette_error_uninited),
ERR_ITERM(kpipette_error_not_lld_prepare),
ERR_ITERM(kpipette_error_tipisload_when_lld_prepare),
ERR_ITERM(kpipette_error_pump_load_val_is_not_empty),
ERR_ITERM(kstep_motor_not_found_zero_point),
ERR_ITERM(kstep_motor_not_go_zero),
ERR_ITERM(kstep_motor_over_temperature),
ERR_ITERM(kstep_motor_over_voltage),
ERR_ITERM(kstep_motor_run_overtime),
ERR_ITERM(kstep_motor_not_enable),
ERR_ITERM(kstep_motor_ioindex_out_of_range),
ERR_ITERM(kstep_motor_subic_reset),
ERR_ITERM(kstep_motor_drv_err),
ERR_ITERM(kstep_motor_uv_cp),
ERR_ITERM(kstep_motor_not_found_point_edge),
ERR_ITERM(kstep_motor_lost_step),
ERR_ITERM(kstep_motor_not_move_to_zero),
ERR_ITERM(kmini_servo_not_enable),
ERR_ITERM(kmini_servo_mode_not_support),
ERR_ITERM(kfan_hardware_fault),
ERR_ITERM(kwater_cooling_fan_error),
ERR_ITERM(kwater_cooling_temperature_sensor_error),
ERR_ITERM(kwater_cooling_pump_is_error),
ERR_ITERM(kwater_cooling_pelter_is_error),
};
const char* error2str(int32_t code) {
for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++) {
if (table[i].index == code) {
return table[i].info;
}
}
return "unknown error";
}
ecode_table_item_t* error_get_table() { return table; }
int error_get_table_size() { return sizeof(table) / sizeof(table[0]); }
} // namespace err
} // namespace iflytop