From bebaea96b367c2ab463e52dc6e8c15fd8d1384a6 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 15 Oct 2023 13:45:52 +0800 Subject: [PATCH] update --- .settings/language.settings.xml | 4 ++-- sdk | 2 +- usrc/main.cpp | 21 ++++++++++----------- usrc/project_configs.h | 7 +++---- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index b52317d..93bee9f 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/sdk b/sdk index 5f412fc..245a8e3 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 5f412fc13617a87778caecdfcc7847038536ed7b +Subproject commit 245a8e32a993dd2e9c17a64eed522d22841b3928 diff --git a/usrc/main.cpp b/usrc/main.cpp index 380cd6c..b12eac4 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -2,15 +2,14 @@ #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/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\ztmc4361A.hpp" #include "sdk\components\xy_robot_ctrl_module\xy_robot_ctrl_module.hpp" +#include "sdk\components\xy_robot_ctrl_module\zcan_xy_robot_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" // @@ -30,9 +29,7 @@ static TMC4361A motorb; static ZCanCmder zcanCmder; static ZCanBasicOrderModule zcanBasicOrderModule; -static StepMotorCtrlModule stepMotorCtrlModule; -static ZCanStepMotorCtrlModule zcanStepMotorCtrlModule; - +static StepMotorCtrlModule stepMotorCtrlModule; static XYRobotCtrlModule xyRobotCtrlModule; static ZCANXYRobotCtrlModule zcanXYRobotCtrlModule; @@ -50,6 +47,8 @@ void umain() { zos_cfg_t zoscfg; zos_init(&zoscfg); + ZLOGI(TAG, "boardid:%d moduleid:%d", BOARD_ID, MODULE_ID); + /******************************************************************************* * NVSINIT * *******************************************************************************/ @@ -92,17 +91,17 @@ void umain() { ZLOGI(TAG, "motorb initialize TMC4361A:%x DriverIC:%x", motorb.readICVersion(), motorb.readSubICVersion()); } - motora.setAcceleration(300000); - motora.setDeceleration(300000); + motora.setAcceleration(300); + motora.setDeceleration(300); motora.setIHOLD_IRUN(0, 2, 10); - motorb.setAcceleration(300000); - motorb.setDeceleration(300000); + motorb.setAcceleration(300); + motorb.setDeceleration(300); motorb.setIHOLD_IRUN(0, 2, 10); motora.rotate(0); motorb.rotate(0); - auto zcanCmder_cfg = zcanCmder.createCFG(DEVICE_ID); + auto zcanCmder_cfg = zcanCmder.createCFG(BOARD_ID); zcanCmder.init(zcanCmder_cfg); /******************************************************************************* @@ -136,7 +135,7 @@ void umain() { xyRobotCtrlModule.initialize(&motora, &motorb, &input[6], &input[7], XYRobotCtrlModule_1_FLASH_MARK); xyRobotCtrlModule.dumpcfg(); - zcanXYRobotCtrlModule.initialize(&zcanCmder, 1, &xyRobotCtrlModule); + zcanXYRobotCtrlModule.initialize(&zcanCmder, MODULE_ID, &xyRobotCtrlModule); while (true) { OSDefaultSchduler::getInstance()->loop(); diff --git a/usrc/project_configs.h b/usrc/project_configs.h index cd711fa..9d57dd5 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,9 +1,8 @@ #pragma once - #define VERSION "v1.0.0" #define MANUFACTURER "http://www.iflytop.com/" -#define PROJECT_NAME "filarobot_arm" +#define PROJECT_NAME "xy_robot_board" #define DEBUG_UART huart1 #define DEBUG_LIGHT_GPIO PE2 @@ -14,8 +13,8 @@ #define IFLYTOP_ENABLE_OS 1 #define IFLYTOP_PREEMPTPRIORITY_DEFAULT 5 - -#define DEVICE_ID (2) +#define MODULE_ID (1) +#define BOARD_ID (1 + ZCAN_CMD_PUBLIC_DEVICE_ID_XY_ROBOT_BOARD_OFFEST) /****************************************FLASH***************************************/ #define IFLYTOP_NVS_CONFIG_FLASH_SECTOR 8