From 829b5f702743cceca05db0d69251e73ceaa3b9c9 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 12 Oct 2023 21:07:30 +0800 Subject: [PATCH] update --- sdk | 2 +- usrc/main.cpp | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sdk b/sdk index 7ac96f7..b3dbb15 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 7ac96f7487c64d6e23bf4e3e3c09bc1f910ddc96 +Subproject commit b3dbb159e8a0f0593bfc9088c96ae7c24edb975a diff --git a/usrc/main.cpp b/usrc/main.cpp index da2f25d..3dcdd4f 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -2,15 +2,15 @@ #include #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) {