Skip to content

Commit

Permalink
moved magic stack size numbers to msb_conf.h
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanK952 committed Dec 3, 2024
1 parent ffce6fc commit 5fa618c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
13 changes: 12 additions & 1 deletion Core/Inc/msb_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,20 @@
#define SENSOR_STRAIN
//#define SENSOR_TOF

#define SENSOR_IMU
// #define SENSOR_IMU //NOTE
// on knuckle or /wheel
//#define SENSOR_WHEEL_TEMP

// VERBOSE LOGGING
#define LOG_VERBOSE

//Note
//STACK SIZES
#define CAN_DISPATCH_STACK_SIZE 128 * 8 //can_dispatch_handle
#define LED_CONTROLLER_STACK_SIZE 32 * 8 //led_controller_handle
#define DEFAULT_TASK_STACK_SIZE 128 * 4 //defaultTaskHandle
#define TEMP_MONITOR_STACK_SIZE 64 * 8 //temp_monitor_handle
#define IMU_MONITOR_STACK_SIZE 64 * 8 //imu_monitor_handle
#define TOF_MONITOR_STACK_SIZE 128 * 8 //tof_monitor_handle
#define SHOCKPOT_MONITOR_STACK_SIZE 64 * 8 //shockpot_monitor_handle
#define STRAIN_MONITOR_STACK_SIZE 64 * 8 //strain_monitor_handle
2 changes: 1 addition & 1 deletion Core/Src/can_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void can1_init()
osThreadId_t can_dispatch_handle;
const osThreadAttr_t can_dispatch_attributes = {
.name = "CanDispatch",
.stack_size = 128 * 8,
.stack_size = CAN_DISPATCH_STACK_SIZE,
.priority = (osPriority_t)osPriorityRealtime5,
};

Expand Down
2 changes: 1 addition & 1 deletion Core/Src/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern device_loc_t device_loc;
osThreadId_t led_controller_handle;
const osThreadAttr_t led_controller_attributes = {
.name = "LedController",
.stack_size = 32 * 8,
.stack_size = LED_CONTROLLER_STACK_SIZE,
.priority = (osPriority_t)osPriorityBelowNormal1,
};

Expand Down
2 changes: 1 addition & 1 deletion Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ UART_HandleTypeDef huart2;
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.stack_size = 128 * 4,
.stack_size = DEFAULT_TASK_STACK_SIZE,
.priority = (osPriority_t) osPriorityNormal,
};
/* USER CODE BEGIN PV */
Expand Down
10 changes: 5 additions & 5 deletions Core/Src/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ uint16_t convert_can(uint16_t original_value, device_loc_t mode)
osThreadId_t temp_monitor_handle;
const osThreadAttr_t temp_monitor_attributes = {
.name = "TempMonitor",
.stack_size = 64 * 16,
.stack_size = TEMP_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh1,
};

Expand Down Expand Up @@ -88,7 +88,7 @@ void vTempMonitor(void *pv_params)
osThreadId_t imu_monitor_handle;
const osThreadAttr_t imu_monitor_attributes = {
.name = "IMUMonitor",
.stack_size = 64 * 8,
.stack_size = IMU_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh,
};

Expand Down Expand Up @@ -174,7 +174,7 @@ void vIMUMonitor(void *pv_params)
osThreadId_t tof_monitor_handle;
const osThreadAttr_t tof_monitor_attributes = {
.name = "TOFMonitor",
.stack_size = 128 * 8,
.stack_size = TOF_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh,
};

Expand Down Expand Up @@ -213,7 +213,7 @@ void vTOFMonitor(void *pv_params)
osThreadId_t shockpot_monitor_handle;
const osThreadAttr_t shockpot_monitor_attributes = {
.name = "ShockpotMonitor",
.stack_size = 64 * 8,
.stack_size = SHOCKPOT_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh1,
};

Expand Down Expand Up @@ -251,7 +251,7 @@ void vShockpotMonitor(void *pv_params)
osThreadId_t strain_monitor_handle;
const osThreadAttr_t strain_monitor_attributes = {
.name = "StrainMonitor",
.stack_size = 64 * 8,
.stack_size = STRAIN_MONITOR_STACK_SIZE,
.priority = (osPriority_t)osPriorityHigh1,
};

Expand Down

0 comments on commit 5fa618c

Please sign in to comment.