Compare commits

...

3 Commits

Author SHA1 Message Date
Jean-François Milants f9e0e443b8 New changes according to the review : Priority 0 for display, 1 for system, timer and ble host, and 2 for ble LL 2022-03-17 21:22:59 +01:00
Jean-François Milants a02a35ffdb Fix priorities of BLE tasks 2022-03-14 21:54:13 +01:00
Jean-François Milants 880f5fc3d7 In current configuration, the timer task (the one from FreeRTOS) has 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 https://github.com/InfiniTimeOrg/InfiniTime/issues/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.
2022-03-14 20:54:04 +01:00
4 changed files with 5 additions and 4 deletions

View File

@ -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)

View File

@ -77,6 +77,7 @@ int GAPEventCallback(struct ble_gap_event* event, void* arg) {
void NimbleController::Init() {
while (!ble_hs_synced()) {
vTaskDelay(10);
}
nptr = this;

View File

@ -38,7 +38,7 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn)
* since it has compatible prototype.
*/
xTaskCreate(nimble_port_ll_task_func, "ll", configMINIMAL_STACK_SIZE + 200,
NULL, configMAX_PRIORITIES - 1, &ll_task_h);
NULL, 2, &ll_task_h);
#endif
/*
@ -47,5 +47,5 @@ nimble_port_freertos_init(TaskFunction_t host_task_fn)
* default queue it is just easier to make separate task which does this.
*/
xTaskCreate(host_task_fn, "ble", configMINIMAL_STACK_SIZE + 600,
NULL, tskIDLE_PRIORITY + 1, &host_task_h);
NULL, 1, &host_task_h);
}

View File

@ -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);
}
}