|
|
@ -1,5 +1,7 @@ |
|
|
|
#include "device.hpp"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "sdk\components\eq_20_asb_motor\eq20_servomotor.hpp"
|
|
|
|
#include "sdk\components\mini_servo_motor\mini_servo_motor_ctrl_module.hpp"
|
|
|
|
|
|
|
@ -82,7 +84,7 @@ void Device::init_bus() { |
|
|
|
/*******************************************************************************
|
|
|
|
* 初始化MODBUS总线 * |
|
|
|
*******************************************************************************/ |
|
|
|
m_modbus.initialize(&huart2, &hdma_usart2_rx, &hdma_usart2_tx); |
|
|
|
m_modbus.initialize(&huart2, &hdma_usart2_tx, &hdma_usart2_rx); |
|
|
|
} |
|
|
|
|
|
|
|
#define REG_SUB_MODULE(table) \
|
|
|
@ -110,8 +112,10 @@ void Device::sub_module_init() { |
|
|
|
/**
|
|
|
|
* @brief 初始化主轴电机 |
|
|
|
*/ |
|
|
|
static Eq20ServoMotor::servo_config_t default_servo_cfg = //
|
|
|
|
{.default_acc_time_ms = 1000, .default_velocity = 800, .find_zero_velocity = 100}; |
|
|
|
static Eq20ServoMotor eq20_motor; |
|
|
|
eq20_motor.init(1, &m_modbus, 1); |
|
|
|
eq20_motor.init(1, &m_modbus, 1, default_servo_cfg); |
|
|
|
m_device_manager.registerModule(&eq20_motor); |
|
|
|
|
|
|
|
/**
|
|
|
@ -150,6 +154,10 @@ void Device::sub_module_init() { |
|
|
|
can_step_motor_proxy[i++].initialize(61, &m_zcanbus); |
|
|
|
can_step_motor_proxy[i++].initialize(62, &m_zcanbus); |
|
|
|
REG_SUB_MODULE(can_step_motor_proxy); |
|
|
|
|
|
|
|
m_device_manager.module_set_reg(42, kreg_stepmotor_ihold, 4); |
|
|
|
m_device_manager.module_set_reg(42, kreg_stepmotor_irun, 28); |
|
|
|
m_device_manager.module_active_cfg(42); |
|
|
|
} |
|
|
|
|
|
|
|
void Device::line_locking_solenoid_valve_init() {} |
|
|
|