|
|
@ -10,8 +10,11 @@ |
|
|
|
#include "sdk\components\eq_20_asb_motor\eq20_servomotor.hpp"
|
|
|
|
#include "sdk\components\iflytop_can_slave_module_master_end\stepmotor.hpp"
|
|
|
|
#include "sdk\components\iflytop_can_slave_v1\iflytop_can_master.hpp"
|
|
|
|
#include "sdk\components\scriptcmder_module\xy_robot_script_cmder_module.hpp"
|
|
|
|
#include "sdk\components\step_motor_45\step_motor_45.hpp"
|
|
|
|
#include "sdk\components\step_motor_45\step_motor_45_scheduler.hpp"
|
|
|
|
#include "sdk\components\zcancmder\zcanreceiver_master.hpp"
|
|
|
|
#include "sdk\components\zcancmder_master_module\zcan_xy_robot_master_module.hpp"
|
|
|
|
|
|
|
|
#define TAG "main"
|
|
|
|
namespace iflytop { |
|
|
@ -120,14 +123,17 @@ static StepMotor45::cfg_t cfg6 = { |
|
|
|
* ´úÂë * |
|
|
|
*******************************************************************************/ |
|
|
|
namespace iflytop { |
|
|
|
StepMotor45 g_step_motor45[7]; |
|
|
|
StepMotor g_step_motor[10]; |
|
|
|
IflytopCanMaster m_IflytopCanMaster; |
|
|
|
CmdScheduler cmdScheduler; |
|
|
|
|
|
|
|
ModbusBlockHost g_modbusblockhost; |
|
|
|
Eq20ServoMotor g_eq20servomotor; |
|
|
|
FeiTeServoMotor g_feiteservomotor; |
|
|
|
StepMotor45 g_step_motor45[7]; |
|
|
|
StepMotor g_step_motor[10]; |
|
|
|
ZCanCommnaderMaster m_zcanCommnaderMaster; |
|
|
|
CmdScheduler cmdScheduler; |
|
|
|
XYRobotScriptCmderModule xyRobotScriptCmderModule; |
|
|
|
|
|
|
|
ModbusBlockHost g_modbusblockhost; |
|
|
|
Eq20ServoMotor g_eq20servomotor; |
|
|
|
FeiTeServoMotor g_feiteservomotor; |
|
|
|
I_XYRobotCtrlModule* g_xyrobotctrlmodule = nullptr; |
|
|
|
|
|
|
|
} // namespace iflytop
|
|
|
|
|
|
|
|
void regfn() { |
|
|
@ -182,6 +188,11 @@ void regfn() { |
|
|
|
CHECK_ARGC(1); |
|
|
|
osDelay(atoi(argv[1])); |
|
|
|
}); |
|
|
|
|
|
|
|
cmdScheduler.registerCmd("hbot_enable", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) { |
|
|
|
CHECK_ARGC(0); |
|
|
|
g_xyrobotctrlmodule->enable(false); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
extern "C" { |
|
|
@ -201,9 +212,18 @@ void Main::run() { |
|
|
|
zos_cfg_t zoscfg; |
|
|
|
zos_init(&zoscfg); |
|
|
|
|
|
|
|
auto config = m_IflytopCanMaster.createDefaultConfig(1); |
|
|
|
m_IflytopCanMaster.initialize(config); |
|
|
|
auto* cfg = m_zcanCommnaderMaster.createCFG(); |
|
|
|
m_zcanCommnaderMaster.init(cfg); |
|
|
|
g_xyrobotctrlmodule = zcancmder_master::create_xyrobot_ctrl_module(&m_zcanCommnaderMaster, 1); |
|
|
|
g_xyrobotctrlmodule->enable(false); |
|
|
|
|
|
|
|
cmdScheduler.initialize(&DEBUG_UART, 1000); |
|
|
|
xyRobotScriptCmderModule.initialize(&cmdScheduler); |
|
|
|
xyRobotScriptCmderModule.regXYRobot(1, g_xyrobotctrlmodule); |
|
|
|
|
|
|
|
regfn(); |
|
|
|
|
|
|
|
#if 0
|
|
|
|
int i = 1; |
|
|
|
g_step_motor[i++].initialize(11, 10000, &m_IflytopCanMaster); |
|
|
|
g_step_motor[i++].initialize(12, 10000, &m_IflytopCanMaster); |
|
|
@ -232,20 +252,18 @@ void Main::run() { |
|
|
|
|
|
|
|
step_motor45_scheduler.start(); |
|
|
|
|
|
|
|
cmdScheduler.initialize(&DEBUG_UART, 1000); |
|
|
|
|
|
|
|
g_modbusblockhost.initialize(&huart2); |
|
|
|
g_eq20servomotor.init(&g_modbusblockhost); |
|
|
|
|
|
|
|
g_feiteservomotor.initialize(&huart3, &hdma_usart3_rx, &hdma_usart3_tx); |
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
step_motor_cmd_reg(); |
|
|
|
regfn(); |
|
|
|
#endif
|
|
|
|
while (true) { |
|
|
|
OSDefaultSchduler::getInstance()->loop(); |
|
|
|
cmdScheduler.schedule(); |
|
|
|
m_IflytopCanMaster.periodicJob(); |
|
|
|
// m_IflytopCanMaster.writeReg(1,1,1,10);
|
|
|
|
// osDelay(1);
|
|
|
|
osDelay(1); |
|
|
|
} |
|
|
|
} |