Skip to content

Commit

Permalink
In current configuration, the timer task (the one from FreeRTOS) has …
Browse files Browse the repository at this point in the history
…the lowest priority (0). Both display and system tasks are also set on priority 0.

In cases where any other task takes too much time to execute (it can happen in Display Task, see InfiniTimeOrg/InfiniTime#825), the timer task does not have the opportunity to run fast enough to detect and debounce presses on the button.

This commit sets the following priorities:
 - [0] : Display  Task
 - [1] : Timer and System tasks
 - [2] : BLE Host
 - [3] : BLE LL

This way, we ensure that button presses will always be detected, even if the rendering of the display takes a huge amount of time.
  • Loading branch information
JF002 committed Mar 21, 2022
1 parent 615a986 commit 923b1ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */
#define configCPU_CLOCK_HZ (SystemCoreClock)
#define configTICK_RATE_HZ 1024
#define configMAX_PRIORITIES (3)
#define configMAX_PRIORITIES (4)
#define configMINIMAL_STACK_SIZE (120)
#define configTOTAL_HEAP_SIZE (1024 * 17)
#define configMAX_TASK_NAME_LEN (4)
Expand Down Expand Up @@ -93,7 +93,7 @@

/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY (0)
#define configTIMER_TASK_PRIORITY (1)
#define configTIMER_QUEUE_LENGTH 32
#define configTIMER_TASK_STACK_DEPTH (300)

Expand Down
2 changes: 1 addition & 1 deletion src/systemtask/SystemTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,

void SystemTask::Start() {
systemTasksMsgQueue = xQueueCreate(10, 1);
if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 0, &taskHandle)) {
if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 1, &taskHandle)) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
}
Expand Down

0 comments on commit 923b1ae

Please sign in to comment.