From d308aa6ebd209a941b4acba404bdcac0e10c2510 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 12 Oct 2023 11:15:06 +0800 Subject: [PATCH] update --- sdk | 2 +- usrc/main.cpp | 21 +++++++++++++-------- usrc/project_configs.h | 6 +++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/sdk b/sdk index 40d6da4..61021e0 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 40d6da40267dc39bcff6b282dd6ed6e7da4408df +Subproject commit 61021e00a94a56c52f49a82ca5bbedf3f17349d1 diff --git a/usrc/main.cpp b/usrc/main.cpp index 2eba0ac..4710ba4 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -36,6 +36,8 @@ static ZCanStepMotorCtrlModule zcanStepMotorCtrlModule; static XYRobotCtrlModule xyRobotCtrlModule; static ZCANXYRobotCtrlModule zcanXYRobotCtrlModule; +#define XYRobotCtrlModule_1_FLASH_MARK "XYRobotCtrlModule_1" + void umain() { chip_cfg_t chipcfg; chipcfg.us_dleay_tim = &DELAY_US_TIMER; @@ -48,12 +50,18 @@ void umain() { zos_cfg_t zoscfg; zos_init(&zoscfg); + /******************************************************************************* + * NVSINIT * + *******************************************************************************/ ZNVS::ins().initialize(); - // ZNVS::ins().set_config_int32("test", 1234); - ZNVS::ins().dumpcfg(); + { + static I_XYRobotCtrlModule::flash_config_t cfg; + XYRobotCtrlModule::create_default_cfg(cfg); + ZNVS::ins().alloc_config(XYRobotCtrlModule_1_FLASH_MARK, (uint8_t*)&cfg, sizeof(cfg)); + } + ZNVS::ins().init_config(); osDelay(1000); - { TMC4361A::cfg_t cfg = { .spi = &TMC_MOTOR_SPI, // @@ -126,11 +134,8 @@ void umain() { input[6].initAsInput(ARM_SENSOR7_GPIO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); input[7].initAsInput(ARM_SENSOR8_GPIO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); - xyRobotCtrlModule.initialize(&motora, &motorb, &input[6], &input[7]); - I_XYRobotCtrlModule::base_param_t base_param; - xyRobotCtrlModule.create_default_cfg(base_param); - xyRobotCtrlModule.set_base_param(base_param); - + xyRobotCtrlModule.initialize(&motora, &motorb, &input[6], &input[7], XYRobotCtrlModule_1_FLASH_MARK); + xyRobotCtrlModule.dumpcfg(); zcanXYRobotCtrlModule.initialize(&zcanCmder, 1, &xyRobotCtrlModule); while (true) { diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 49f1bbf..cd711fa 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,5 +1,6 @@ #pragma once + #define VERSION "v1.0.0" #define MANUFACTURER "http://www.iflytop.com/" #define PROJECT_NAME "filarobot_arm" @@ -13,12 +14,11 @@ #define IFLYTOP_ENABLE_OS 1 #define IFLYTOP_PREEMPTPRIORITY_DEFAULT 5 -#define IFLYTOP_NVS_CONFIG_MAX_ITEM_NUM 100 -#define IFLYTOP_NVS_CONFIG_FLASH_SECTOR 8 - #define DEVICE_ID (2) +/****************************************FLASH***************************************/ +#define IFLYTOP_NVS_CONFIG_FLASH_SECTOR 8 /*********************************************************************************/ // MOTOR1