|
|
@ -2,15 +2,15 @@ |
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp"
|
|
|
|
#include "sdk/components/zcancmder_module/zcan_step_motor_ctrl_module.hpp"
|
|
|
|
#include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_script_cmder_module.hpp"
|
|
|
|
#include "sdk/components/step_motor_ctrl_module/zcan_master_step_motor_ctrl_module.hpp"
|
|
|
|
#include "sdk/components/step_motor_ctrl_module/zcan_step_motor_ctrl_module.hpp"
|
|
|
|
#include "sdk/os/zos.hpp"
|
|
|
|
#include "sdk\components\flash\zsimple_flash.hpp"
|
|
|
|
#include "sdk\components\mini_servo_motor\feite_servo_motor.hpp"
|
|
|
|
#include "sdk\components\tmc\ic\ztmc5130.hpp"
|
|
|
|
#include "sdk\components\xy_robot_ctrl_module\xy_robot_ctrl_module.hpp"
|
|
|
|
#include "sdk\components\zcancmder\zcanreceiver.hpp"
|
|
|
|
#include "sdk\components\zcancmder_module\zcan_basic_order_module.hpp"
|
|
|
|
#include "sdk\components\zcancmder_module\zcan_xy_robot_module.hpp"
|
|
|
|
//
|
|
|
|
#include "sdk\components\flash\znvs.hpp"
|
|
|
|
//
|
|
|
@ -62,14 +62,20 @@ void umain() { |
|
|
|
|
|
|
|
uint8_t deviceId = getId(); |
|
|
|
ZLOGI(TAG, "deviceId:%d", deviceId); |
|
|
|
if (deviceId == 0) { |
|
|
|
chip_set_error(); |
|
|
|
while (true) { |
|
|
|
osDelay(1000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* NVSINIT * |
|
|
|
*******************************************************************************/ |
|
|
|
ZNVS::ins().initialize(IFLYTOP_NVS_CONFIG_FLASH_SECTOR); |
|
|
|
{ |
|
|
|
static I_XYRobotCtrlModule::flash_config_t cfg; |
|
|
|
XYRobotCtrlModule::create_default_cfg(cfg); |
|
|
|
static I_StepMotorCtrlModule::flash_config_t cfg; |
|
|
|
StepMotorCtrlModule::create_default_cfg(cfg); |
|
|
|
ZNVS::ins().alloc_config(MOTOR_CFG_FLASH_MARK, (uint8_t*)&cfg, sizeof(cfg)); |
|
|
|
} |
|
|
|
ZNVS::ins().init_config(); |
|
|
@ -95,7 +101,7 @@ void umain() { |
|
|
|
g_motor.rotate(0); |
|
|
|
// g_motor.enable(false);
|
|
|
|
|
|
|
|
auto zcanCmder_cfg = g_zcanCmder.createCFG(deviceId); |
|
|
|
auto zcanCmder_cfg = g_zcanCmder.createCFG(deviceId + ZCAN_CMD_PUBLIC_DEVICE_ID_STEP_MOTOR_BOARD_OFFEST); |
|
|
|
g_zcanCmder.init(zcanCmder_cfg); |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
@ -145,7 +151,7 @@ void umain() { |
|
|
|
}, |
|
|
|
1000); |
|
|
|
|
|
|
|
//g_stepMotorCtrlModule.initialize(deviceId, &g_motor, input, ZARRAY_SIZE(input));
|
|
|
|
g_stepMotorCtrlModule.initialize(deviceId, &g_motor, input, ZARRAY_SIZE(input), "MOTOR_CFG_FLASH_MARK"); |
|
|
|
g_zcanStepMotorCtrlModule.initialize(&g_zcanCmder, 1, &g_stepMotorCtrlModule); |
|
|
|
|
|
|
|
while (true) { |
|
|
|