diff --git a/Core/Inc/FreeRTOSConfig.h b/Core/Inc/FreeRTOSConfig.h index c0a8ac3..3c7e84e 100644 --- a/Core/Inc/FreeRTOSConfig.h +++ b/Core/Inc/FreeRTOSConfig.h @@ -64,7 +64,7 @@ #define configTICK_RATE_HZ ((TickType_t)1000) #define configMAX_PRIORITIES ( 7 ) #define configMINIMAL_STACK_SIZE ((uint16_t)128) -#define configTOTAL_HEAP_SIZE ((size_t)15360) +#define configTOTAL_HEAP_SIZE ((size_t)20000) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_16_BIT_TICKS 0 #define configUSE_MUTEXES 1 diff --git a/Core/Src/usart.c b/Core/Src/usart.c index b1ec447..9e0c7b4 100644 --- a/Core/Src/usart.c +++ b/Core/Src/usart.c @@ -103,7 +103,7 @@ void MX_USART2_UART_Init(void) /* USER CODE END USART2_Init 1 */ huart2.Instance = USART2; - huart2.Init.BaudRate = 38400; + huart2.Init.BaudRate = 115200; huart2.Init.WordLength = UART_WORDLENGTH_8B; huart2.Init.StopBits = UART_STOPBITS_1; huart2.Init.Parity = UART_PARITY_NONE; @@ -132,7 +132,7 @@ void MX_USART3_UART_Init(void) /* USER CODE END USART3_Init 1 */ huart3.Instance = USART3; - huart3.Init.BaudRate = 9600; + huart3.Init.BaudRate = 115200; huart3.Init.WordLength = UART_WORDLENGTH_8B; huart3.Init.StopBits = UART_STOPBITS_1; huart3.Init.Parity = UART_PARITY_NONE; diff --git a/Intelligent_winding_robot_zarm.ioc b/Intelligent_winding_robot_zarm.ioc index e7a600b..26d0b7f 100644 --- a/Intelligent_winding_robot_zarm.ioc +++ b/Intelligent_winding_robot_zarm.ioc @@ -67,10 +67,11 @@ Dma.USART2_TX.1.PeriphInc=DMA_PINC_DISABLE Dma.USART2_TX.1.Priority=DMA_PRIORITY_LOW Dma.USART2_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode FREERTOS.FootprintOK=true -FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_NEWLIB_REENTRANT,configUSE_RECURSIVE_MUTEXES,configUSE_COUNTING_SEMAPHORES,configRECORD_STACK_HIGH_ADDRESS,configENABLE_FPU +FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_NEWLIB_REENTRANT,configUSE_RECURSIVE_MUTEXES,configUSE_COUNTING_SEMAPHORES,configRECORD_STACK_HIGH_ADDRESS,configENABLE_FPU,configTOTAL_HEAP_SIZE FREERTOS.Tasks01=defaultTask,-3,1024,StartDefaultTask,As weak,NULL,Dynamic,NULL,NULL FREERTOS.configENABLE_FPU=1 FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1 +FREERTOS.configTOTAL_HEAP_SIZE=20000 FREERTOS.configUSE_COUNTING_SEMAPHORES=1 FREERTOS.configUSE_NEWLIB_REENTRANT=1 FREERTOS.configUSE_RECURSIVE_MUTEXES=1 @@ -269,7 +270,7 @@ ProjectManager.ToolChainLocation= ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=true -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_CRC_Init-CRC-false-HAL-true,7-MX_RNG_Init-RNG-false-HAL-true,8-MX_TIM7_Init-TIM7-false-HAL-true,9-MX_SPI1_Init-SPI1-false-HAL-true,10-MX_TIM6_Init-TIM6-false-HAL-true,11-MX_TIM1_Init-TIM1-false-HAL-true,12-MX_CAN1_Init-CAN1-false-HAL-true,13-MX_USART3_UART_Init-USART3-false-HAL-true,14-MX_I2C1_Init-I2C1-false-HAL-true,15-MX_ADC1_Init-ADC1-false-HAL-true,16-MX_TIM2_Init-TIM2-false-HAL-true,17-MX_USART2_UART_Init-USART2-false-HAL-true +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_CRC_Init-CRC-false-HAL-true,7-MX_RNG_Init-RNG-false-HAL-true,8-MX_TIM7_Init-TIM7-false-HAL-true,9-MX_SPI1_Init-SPI1-false-HAL-true,10-MX_TIM6_Init-TIM6-false-HAL-true,11-MX_TIM1_Init-TIM1-false-HAL-true,12-MX_CAN1_Init-CAN1-false-HAL-true,13-MX_USART3_UART_Init-USART3-false-HAL-true,14-MX_I2C1_Init-I2C1-false-HAL-true,15-MX_ADC1_Init-ADC1-false-HAL-true,16-MX_TIM2_Init-TIM2-false-HAL-true,17-MX_USART2_UART_Init-USART2-false-HAL-true,18-MX_UART4_Init-UART4-false-HAL-true RCC.48MHZClocksFreq_Value=48000000 RCC.AHBFreq_Value=144000000 RCC.APB1CLKDivider=RCC_HCLK_DIV4 @@ -355,10 +356,10 @@ UART4.VirtualMode=Asynchronous USART1.BaudRate=961200 USART1.IPParameters=VirtualMode,BaudRate USART1.VirtualMode=VM_ASYNC -USART2.BaudRate=9600 +USART2.BaudRate=115200 USART2.IPParameters=VirtualMode,BaudRate USART2.VirtualMode=VM_ASYNC -USART3.BaudRate=9600 +USART3.BaudRate=115200 USART3.IPParameters=VirtualMode,BaudRate USART3.VirtualMode=VM_ASYNC VP_CRC_VS_CRC.Mode=CRC_Activate diff --git a/Intelligent_winding_robot_zarm.launch b/Intelligent_winding_robot_zarm.launch index 281c803..6221db8 100644 --- a/Intelligent_winding_robot_zarm.launch +++ b/Intelligent_winding_robot_zarm.launch @@ -51,7 +51,7 @@ - + diff --git a/sdk b/sdk index 2835695..85b8278 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 283569575d2fdfa9a9719bbcfba1d874d52aff8f +Subproject commit 85b827815841cd0ad95352d5ee5917a6034c45e3 diff --git a/usrc/main.cpp b/usrc/main.cpp index f07f931..b2f0772 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -55,17 +55,17 @@ static void initsubmodule() { input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); input[1].initAsInput(MOTOR0_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 = 80; - smcm_cfg.base_param.distance_scale_denominator = 1; - smcm_cfg.base_param.ihold = 1; - smcm_cfg.base_param.irun = 8; - smcm_cfg.base_param.x_shaft = false; - smcm_cfg.base_param.maxspeed = 500; - smcm_cfg.base_param.run_to_zero_speed = 100; - smcm_cfg.base_param.max_x = 0; - smcm_cfg.base_param.min_x = 0; + smcm_cfg.base_param.motor_one_circle_pulse = 80; + smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1; + smcm_cfg.base_param.stepmotor_ihold = 1; + smcm_cfg.base_param.stepmotor_irun = 8; + smcm_cfg.base_param.motor_shaft = false; + smcm_cfg.base_param.motor_default_velocity = 500; + smcm_cfg.base_param.motor_run_to_zero_speed = 100; + smcm_cfg.base_param.max_d = 0; + smcm_cfg.base_param.min_d = 0; g_stepMotorCtrlModule.initialize(initer.get_module_id(1), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); initer.register_module(&g_stepMotorCtrlModule); @@ -92,17 +92,17 @@ 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 = 80; - smcm_cfg.base_param.distance_scale_denominator = 1; - smcm_cfg.base_param.ihold = 1; - smcm_cfg.base_param.irun = 8; - smcm_cfg.base_param.x_shaft = false; - smcm_cfg.base_param.maxspeed = 500; - smcm_cfg.base_param.run_to_zero_speed = 100; - smcm_cfg.base_param.max_x = 0; - smcm_cfg.base_param.min_x = 0; + smcm_cfg.base_param.motor_one_circle_pulse = 100; + smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1; + smcm_cfg.base_param.stepmotor_ihold = 4; + smcm_cfg.base_param.stepmotor_irun = 16; + smcm_cfg.base_param.motor_shaft = true; + smcm_cfg.base_param.motor_default_velocity = 50; + smcm_cfg.base_param.motor_run_to_zero_speed = 50; + smcm_cfg.base_param.max_d = 0; + smcm_cfg.base_param.min_d = 0; g_stepMotorCtrlModule.initialize(initer.get_module_id(2), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg); initer.register_module(&g_stepMotorCtrlModule); @@ -122,7 +122,7 @@ static void initsubmodule() { feiteservomotor_bus.initialize(&huart2, &hdma_usart2_rx, &hdma_usart2_tx); static MiniRobotCtrlModule::flash_config_t cfg = {0}; - cfg.default_torque = 100; + cfg.default_torque = 400; mini_servo.initialize(initer.get_module_id(3), &feiteservomotor_bus, 1, &cfg); initer.register_module(&mini_servo); } diff --git a/usrc/project_configs.h b/usrc/project_configs.h index 7718615..e9c9196 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -1,5 +1,5 @@ #pragma once -#define PC_VERSION "v1.0.1" +#define PC_VERSION "v1.0.0" #define PC_MANUFACTURER "http://www.iflytop.com/" #define PC_PROJECT_NAME "Intelligent_winding_robot_zarm" #define PC_IFLYTOP_ENABLE_OS 1