mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 19:47:44 +08:00
增大了实时系统的栈空间,修复视觉通信函数临时变量导致内存泄漏的问题
This commit is contained in:
@@ -64,7 +64,7 @@
|
|||||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||||
#define configMAX_PRIORITIES ( 7 )
|
#define configMAX_PRIORITIES ( 7 )
|
||||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
||||||
#define configTOTAL_HEAP_SIZE ((size_t)15360)
|
#define configTOTAL_HEAP_SIZE ((size_t)30000)
|
||||||
#define configMAX_TASK_NAME_LEN ( 32 )
|
#define configMAX_TASK_NAME_LEN ( 32 )
|
||||||
#define configUSE_16_BIT_TICKS 0
|
#define configUSE_16_BIT_TICKS 0
|
||||||
#define configUSE_MUTEXES 1
|
#define configUSE_MUTEXES 1
|
||||||
|
|||||||
@@ -52,6 +52,12 @@
|
|||||||
|
|
||||||
/* USER CODE END Variables */
|
/* USER CODE END Variables */
|
||||||
osThreadId defaultTaskHandle;
|
osThreadId defaultTaskHandle;
|
||||||
|
osThreadId insTaskHandle;
|
||||||
|
osThreadId ledTaskHandle;
|
||||||
|
osThreadId robotTaskHandle;
|
||||||
|
osThreadId motorTaskHandle;
|
||||||
|
osThreadId daemonTaskHandle;
|
||||||
|
osThreadId uiTaskHandle;
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
/* USER CODE BEGIN FunctionPrototypes */
|
/* USER CODE BEGIN FunctionPrototypes */
|
||||||
@@ -119,16 +125,16 @@ void MX_FREERTOS_Init(void) {
|
|||||||
/* USER CODE BEGIN RTOS_THREADS */
|
/* USER CODE BEGIN RTOS_THREADS */
|
||||||
/* add threads, ... */
|
/* add threads, ... */
|
||||||
osThreadDef(instask, StartINSTASK, osPriorityNormal, 0, 1024);
|
osThreadDef(instask, StartINSTASK, osPriorityNormal, 0, 1024);
|
||||||
defaultTaskHandle = osThreadCreate(osThread(instask), NULL);
|
insTaskHandle = osThreadCreate(osThread(instask), NULL);
|
||||||
|
|
||||||
osThreadDef(motortask, StartMOTORTASK, osPriorityNormal, 0, 256);
|
osThreadDef(motortask, StartMOTORTASK, osPriorityNormal, 0, 512);
|
||||||
defaultTaskHandle = osThreadCreate(osThread(motortask), NULL);
|
motorTaskHandle = osThreadCreate(osThread(motortask), NULL);
|
||||||
|
|
||||||
osThreadDef(daemontask, StartDAEMONTASK, osPriorityNormal, 0, 512);
|
osThreadDef(daemontask, StartDAEMONTASK, osPriorityNormal, 0, 128);
|
||||||
defaultTaskHandle = osThreadCreate(osThread(daemontask), NULL);
|
daemonTaskHandle = osThreadCreate(osThread(daemontask), NULL);
|
||||||
|
|
||||||
osThreadDef(robottask, StartROBOTTASK, osPriorityNormal, 0, 1024);
|
osThreadDef(robottask, StartROBOTTASK, osPriorityNormal, 0, 1024);
|
||||||
defaultTaskHandle = osThreadCreate(osThread(robottask), NULL);
|
robotTaskHandle = osThreadCreate(osThread(robottask), NULL);
|
||||||
/* USER CODE END RTOS_THREADS */
|
/* USER CODE END RTOS_THREADS */
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -191,7 +197,7 @@ void StartROBOTTASK(void const * argument)
|
|||||||
{
|
{
|
||||||
// 200Hz
|
// 200Hz
|
||||||
RobotTask();
|
RobotTask();
|
||||||
osDelay(10);//syh此处暂时将时间改<E997B4><EFBFBD>?10ms,原因在于未使用缓冲区发送,发<EFBC8C>?<3F>时延时5ms
|
osDelay(5);//syh此处暂时将时间改<E997B4>?10ms,原因在于未使用缓冲区发送,发<EFBC8C>?<3F>时延时5ms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* USER CODE END Application */
|
/* USER CODE END Application */
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ void GimbalInit()
|
|||||||
.cali_mode = BMI088_CALIBRATE_ONLINE_MODE,
|
.cali_mode = BMI088_CALIBRATE_ONLINE_MODE,
|
||||||
.work_mode = BMI088_BLOCK_PERIODIC_MODE,
|
.work_mode = BMI088_BLOCK_PERIODIC_MODE,
|
||||||
};
|
};
|
||||||
imu = BMI088Register(&imu_config);
|
// imu = BMI088Register(&imu_config);
|
||||||
// gimba_IMU_data = INS_Init(); // IMU先初始化,获取姿态数据指针赋给yaw电机的其他数据来源
|
gimba_IMU_data = INS_Init(); // IMU先初始化,获取姿态数据指针赋给yaw电机的其他数据来源
|
||||||
// YAW
|
// YAW
|
||||||
Motor_Init_Config_s yaw_config = {
|
Motor_Init_Config_s yaw_config = {
|
||||||
.can_init_config = {
|
.can_init_config = {
|
||||||
|
|||||||
@@ -78,11 +78,13 @@ Vision_Recv_s *VisionInit(UART_HandleTypeDef *_handle)
|
|||||||
*/
|
*/
|
||||||
void VisionSend(Vision_Send_s *send)
|
void VisionSend(Vision_Send_s *send)
|
||||||
{
|
{
|
||||||
uint16_t flag_register;
|
// buff和txlen必须为static,才能保证在函数退出后不被释放,使得DMA正确完成发送
|
||||||
uint8_t send_buff[VISION_SEND_SIZE];
|
// 析构后的陷阱需要特别注意!
|
||||||
uint16_t tx_len;
|
static uint16_t flag_register;
|
||||||
|
static uint8_t send_buff[VISION_SEND_SIZE];
|
||||||
|
static uint16_t tx_len;
|
||||||
// TODO: code to set flag_register
|
// TODO: code to set flag_register
|
||||||
flag_register = 30<<8|0b00000001;
|
flag_register = 30 << 8 | 0b00000001;
|
||||||
// 将数据转化为seasky协议的数据包
|
// 将数据转化为seasky协议的数据包
|
||||||
get_protocol_send_data(0x02, flag_register, &send->yaw, 3, send_buff, &tx_len);
|
get_protocol_send_data(0x02, flag_register, &send->yaw, 3, send_buff, &tx_len);
|
||||||
USARTSend(vision_usart_instance, send_buff, tx_len, USART_TRANSFER_DMA); // 和视觉通信使用IT,防止和接收使用的DMA冲突
|
USARTSend(vision_usart_instance, send_buff, tx_len, USART_TRANSFER_DMA); // 和视觉通信使用IT,防止和接收使用的DMA冲突
|
||||||
|
|||||||
Reference in New Issue
Block a user