From 6b39ce6260efea05529121472253e59520127d08 Mon Sep 17 00:00:00 2001 From: Tyler Gamvrelis Date: Sun, 5 Aug 2018 16:11:45 -0400 Subject: [PATCH] Change CommandTask priority from osPriorityNormal to osPriorityBelowNormal This fixes a minor bug. --- Robot/Robot.ioc | 2 +- Robot/Src/freertos.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Robot/Robot.ioc b/Robot/Robot.ioc index ee0dcca7..36f504be 100644 --- a/Robot/Robot.ioc +++ b/Robot/Robot.ioc @@ -138,7 +138,7 @@ FREERTOS.IPParameters=Tasks01,FootprintOK,MEMORY_ALLOCATION,INCLUDE_vTaskDelayUn FREERTOS.MEMORY_ALLOCATION=2 FREERTOS.Mutexes01=PCUART,Static,PCUARTControlBlock FREERTOS.Queues01=UART1_req,16,UARTcmd_t,0,Static,UART1_reqBuffer,UART1_reqControlBlock;UART2_req,16,UARTcmd_t,0,Static,UART2_reqBuffer,UART2_reqControlBlock;UART3_req,16,UARTcmd_t,0,Static,UART3_reqBuffer,UART3_reqControlBlock;UART4_req,16,UARTcmd_t,0,Static,UART4_reqBuffer,UART4_reqControlBlock;UART6_req,16,UARTcmd_t,0,Static,UART6_reqBuffer,UART6_reqControlBlock;TXQueue,32,TXData_t,0,Static,TXQueueBuffer,TXQueueControlBlock -FREERTOS.Tasks01=defaultTask,-3,128,StartDefaultTask,Default,NULL,Static,defaultTaskBuffer,defaultTaskControlBlock;UART1Task,0,128,StartUART1Task,As external,NULL,Static,UART1TaskBuffer,UART1TaskControlBlock;UART2Task,0,128,StartUART2Task,As external,NULL,Static,UART2TaskBuffer,UART2TaskControlBlock;UART3Task,0,128,StartUART3Task,As external,NULL,Static,UART3TaskBuffer,UART3TaskControlBlock;UART4Task,0,128,StartUART4Task,As external,NULL,Static,UART4TaskBuffer,UART4TaskControlBlock;UART6Task,0,128,StartUART6Task,As external,NULL,Static,UART6TaskBuffer,UART6TaskControlBlock;IMUTask,0,128,StartIMUTask,As external,NULL,Static,IMUTaskBuffer,IMUTaskControlBlock;CommandTask,0,512,StartCommandTask,As external,NULL,Static,CommandTaskBuffer,CommandTaskControlBlock;RxTask,3,512,StartRxTask,As external,NULL,Static,RxTaskBuffer,RxTaskControlBlock;TxTask,2,512,StartTxTask,As external,NULL,Static,TxTaskBuffer,TxTaskControlBlock +FREERTOS.Tasks01=defaultTask,-3,128,StartDefaultTask,Default,NULL,Static,defaultTaskBuffer,defaultTaskControlBlock;UART1Task,0,128,StartUART1Task,As external,NULL,Static,UART1TaskBuffer,UART1TaskControlBlock;UART2Task,0,128,StartUART2Task,As external,NULL,Static,UART2TaskBuffer,UART2TaskControlBlock;UART3Task,0,128,StartUART3Task,As external,NULL,Static,UART3TaskBuffer,UART3TaskControlBlock;UART4Task,0,128,StartUART4Task,As external,NULL,Static,UART4TaskBuffer,UART4TaskControlBlock;UART6Task,0,128,StartUART6Task,As external,NULL,Static,UART6TaskBuffer,UART6TaskControlBlock;IMUTask,0,128,StartIMUTask,As external,NULL,Static,IMUTaskBuffer,IMUTaskControlBlock;CommandTask,-1,512,StartCommandTask,As external,NULL,Static,CommandTaskBuffer,CommandTaskControlBlock;RxTask,3,512,StartRxTask,As external,NULL,Static,RxTaskBuffer,RxTaskControlBlock;TxTask,2,512,StartTxTask,As external,NULL,Static,TxTaskBuffer,TxTaskControlBlock File.Version=6 I2C1.I2C_Mode=I2C_Fast I2C1.IPParameters=I2C_Mode diff --git a/Robot/Src/freertos.c b/Robot/Src/freertos.c index 9c579727..52c4fad5 100644 --- a/Robot/Src/freertos.c +++ b/Robot/Src/freertos.c @@ -51,7 +51,7 @@ #include "task.h" #include "cmsis_os.h" -/* USER CODE BEGIN Includes */ +/* USER CODE BEGIN Includes */ /** * @file freertos.c * @brief Code for freertos application @@ -238,7 +238,7 @@ void MX_FREERTOS_Init(void) { IMUTaskHandle = osThreadCreate(osThread(IMUTask), NULL); /* definition and creation of CommandTask */ - osThreadStaticDef(CommandTask, StartCommandTask, osPriorityNormal, 0, 512, CommandTaskBuffer, &CommandTaskControlBlock); + osThreadStaticDef(CommandTask, StartCommandTask, osPriorityBelowNormal, 0, 512, CommandTaskBuffer, &CommandTaskControlBlock); CommandTaskHandle = osThreadCreate(osThread(CommandTask), NULL); /* definition and creation of RxTask */ @@ -417,7 +417,6 @@ void StartCommandTask(void const * argument) } } - // TODO: This didn't really have an effect. Need to figure out why if(numIterations % 100 == 0){ // Every 100 iterations, assert torque enable for(uint8_t i = MOTOR1; i <= MOTOR18; i++){