|
@ -337,6 +337,12 @@ int32_t MiniRobotCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t |
|
|
PROCESS_REG(kreg_motor_default_velocity, REG_GET(m_cfg.default_velocity), REG_SET(m_cfg.default_velocity)); |
|
|
PROCESS_REG(kreg_motor_default_velocity, REG_GET(m_cfg.default_velocity), REG_SET(m_cfg.default_velocity)); |
|
|
PROCESS_REG(kreg_module_input_state, module_readio(&val), ACTION_NONE); |
|
|
PROCESS_REG(kreg_module_input_state, module_readio(&val), ACTION_NONE); |
|
|
PROCESS_REG(kreg_robot_pos, motor_read_pos(&val), ACTION_NONE); |
|
|
PROCESS_REG(kreg_robot_pos, motor_read_pos(&val), ACTION_NONE); |
|
|
|
|
|
|
|
|
|
|
|
PROCESS_REG(kreg_motor_temperature, read_voltage(&val), ACTION_NONE); |
|
|
|
|
|
PROCESS_REG(kreg_motor_error_state, read_temperature(&val), ACTION_NONE); |
|
|
|
|
|
PROCESS_REG(kreg_motor_current, read_error_state(&val), ACTION_NONE); |
|
|
|
|
|
PROCESS_REG(kreg_motor_voltage, read_electric_current(&val), ACTION_NONE); |
|
|
|
|
|
|
|
|
default: |
|
|
default: |
|
|
return err::kmodule_not_find_config_index; |
|
|
return err::kmodule_not_find_config_index; |
|
|
break; |
|
|
break; |
|
@ -436,3 +442,20 @@ int32_t MiniRobotCtrlModule::motor_easy_set_current_pos(int32_t pos) { |
|
|
ZLOGI(TAG, "%d motor_easy_set_current_pos %d", m_module_id, pos); |
|
|
ZLOGI(TAG, "%d motor_easy_set_current_pos %d", m_module_id, pos); |
|
|
return position_calibrate(pos); |
|
|
return position_calibrate(pos); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int32_t MiniRobotCtrlModule::read_voltage(int32_t *val) { |
|
|
|
|
|
if (!m_bus->read_voltage(m_id, val)) return err::ksubdevice_overtime; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
int32_t MiniRobotCtrlModule::read_temperature(int32_t *val) { |
|
|
|
|
|
if (!m_bus->read_temperature(m_id, val)) return err::ksubdevice_overtime; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
int32_t MiniRobotCtrlModule::read_error_state(int32_t *val) { |
|
|
|
|
|
if (!m_bus->read_error_state(m_id, val)) return err::ksubdevice_overtime; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
int32_t MiniRobotCtrlModule::read_electric_current(int32_t *val) { |
|
|
|
|
|
if (!m_bus->read_electric_current(m_id, val)) return err::ksubdevice_overtime; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |