From d185131fe19097feff891605043192c111708558 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 1 Jun 2024 20:06:38 +0800 Subject: [PATCH] init --- .gitmodules | 2 +- .vscode | 1 + sdk | 2 +- usrc/main.cpp | 111 ++++++++++------------------------------------------------ 4 files changed, 21 insertions(+), 95 deletions(-) create mode 160000 .vscode diff --git a/.gitmodules b/.gitmodules index 7f56666..2f0d391 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "sdk"] path = sdk - url = zwsd@192.168.1.3:manufacturer_stm32/iflytop_stm32_os_sdk.git + url = zwsd@192.168.1.3:project_boditech_vidas_a8000_v3/a8000_subboard_sdk.git [submodule ".vscode"] path = .vscode url = zwsd@192.168.1.3:project_boditech_vidas_a8000_v3/a8000_subboard_vscode_cfg.git diff --git a/.vscode b/.vscode new file mode 160000 index 0000000..58b654f --- /dev/null +++ b/.vscode @@ -0,0 +1 @@ +Subproject commit 58b654f9593408be7f6c0349bebb519a932dd76b diff --git a/sdk b/sdk index 488b00a..6f30b6d 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 488b00af87cf243c026274389904993be08acae3 +Subproject commit 6f30b6d5d989f02e831655ec5439042b8b8126cf diff --git a/usrc/main.cpp b/usrc/main.cpp index 5600455..cc682d9 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -55,104 +55,29 @@ static void initsubmodule() { input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); - I_StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; + StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; StepMotorCtrlModule::create_default_cfg(smcm_cfg); - smcm_cfg.base_param.distance_scale = 100; - smcm_cfg.base_param.distance_scale_denominator = 1; - smcm_cfg.base_param.irun = 24; - smcm_cfg.base_param.ihold = 1; - smcm_cfg.base_param.x_shaft = false; - smcm_cfg.base_param.maxspeed = INLET_SPEED; - smcm_cfg.base_param.run_to_zero_speed = 50; - stepMotorCtrlModule.initialize(initer.get_module_id(1), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); - initer.register_module(&stepMotorCtrlModule); - } - /** - * @brief Æ½ÒÆ - */ - { - static TMC5130 motor; - static StepMotorCtrlModule stepMotorCtrlModule; - - TMC5130::cfg_t cfg = { - .spi = &TMC_MOTOR_SPI, // - .csgpio = MOTOR2_CSN, // - .ennPin = MOTOR2_ENN, // - .spi_mode_select = MOTOR2_SPI_MODE_SELECT, // - }; - motor.initialize(&cfg); - motor.setMotorShaft(false); - ZLOGI(TAG, "motor2 initialize 5160:%x ", motor.readICVersion()); - - static ZGPIO input[2]; - input[0].initAsInput(MOTOR2_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); - input[1].initAsInput(MOTOR2_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); - - I_StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; - StepMotorCtrlModule::create_default_cfg(smcm_cfg); - smcm_cfg.base_param.distance_scale = 80; - smcm_cfg.base_param.distance_scale_denominator = 1; - smcm_cfg.base_param.irun = 8; - smcm_cfg.base_param.ihold = 1; - smcm_cfg.base_param.x_shaft = false; - smcm_cfg.base_param.maxspeed = TANSLATE_SPEED; - smcm_cfg.base_param.run_to_zero_speed = 100; - - stepMotorCtrlModule.initialize(initer.get_module_id(2), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); - initer.register_module(&stepMotorCtrlModule); - } + smcm_cfg.base_param.motor_shift = 0; + smcm_cfg.base_param.motor_shaft = 0; + smcm_cfg.base_param.motor_one_circle_pulse = 100; + smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1; + smcm_cfg.base_param.motor_default_velocity = INLET_SPEED; + smcm_cfg.base_param.motor_default_acc = 300; + smcm_cfg.base_param.motor_default_dec = 300; + smcm_cfg.base_param.motor_run_to_zero_max_d = 5000; + smcm_cfg.base_param.motor_look_zero_edge_max_d = 100; + smcm_cfg.base_param.motor_run_to_zero_speed = 50; + smcm_cfg.base_param.motor_run_to_zero_dec = 600; + smcm_cfg.base_param.motor_look_zero_edge_speed = 100; + smcm_cfg.base_param.motor_look_zero_edge_dec = 900; + smcm_cfg.base_param.stepmotor_ihold = 1; + smcm_cfg.base_param.stepmotor_irun = 24; + smcm_cfg.base_param.stepmotor_iholddelay = 1000; - /** - * @brief ³öÁÏ - */ - { - static TMC5130 motor; - static StepMotorCtrlModule stepMotorCtrlModule; - - TMC5130::cfg_t cfg = { - .spi = &TMC_MOTOR_SPI, // - .csgpio = MOTOR3_CSN, // - .ennPin = MOTOR3_ENN, // - .spi_mode_select = MOTOR3_SPI_MODE_SELECT, // - }; - motor.initialize(&cfg); - motor.setMotorShaft(false); - ZLOGI(TAG, "motor3 initialize 5160:%x ", motor.readICVersion()); - - static ZGPIO input[2]; - input[0].initAsInput(MOTOR3_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); - input[1].initAsInput(MOTOR3_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); - - I_StepMotorCtrlModule::flash_config_t smcm_cfg = {0}; - StepMotorCtrlModule::create_default_cfg(smcm_cfg); - smcm_cfg.base_param.distance_scale = 100; - smcm_cfg.base_param.distance_scale_denominator = 1; - smcm_cfg.base_param.irun = 24; - smcm_cfg.base_param.ihold = 1; - smcm_cfg.base_param.x_shaft = true; - smcm_cfg.base_param.maxspeed = OUTET_SPEED; - smcm_cfg.base_param.run_to_zero_speed = 50; - - stepMotorCtrlModule.initialize(initer.get_module_id(3), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); + stepMotorCtrlModule.initialize(initer.get_module_id(1), &motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); initer.register_module(&stepMotorCtrlModule); } -#if 1 - { - static M3078CodeScanner codescanner; - static M3078CodeScanner::hardware_config_t cfg = { - .uart = &huart3, - .hdma_rx = nullptr, - .hdma_tx = nullptr, - - .codeReadOkPin = PinNull, - .rstPin = PinNull, - .triggerPin = PE15, - }; - codescanner.initialize(initer.get_module_id(4), &cfg); - initer.register_module(&codescanner); - } -#endif } /*******************************************************************************