diff options
author | JF <jf@codingfield.com> | 2020-10-27 21:55:18 +0100 |
---|---|---|
committer | JF <jf@codingfield.com> | 2020-10-27 21:55:18 +0100 |
commit | 7de43a16608e599369867cb3cfa7d5776a5b6380 (patch) | |
tree | 1750edfed02f547102e468eca485caab3b08e98d /src/systemtask | |
parent | 5983e33b8d7702800dc91a3229b9a7cee75eb006 (diff) | |
parent | c5bf09d21b2ed8e2435ec625e351594f58713924 (diff) |
Fix conflicts
Diffstat (limited to 'src/systemtask')
-rw-r--r-- | src/systemtask/SystemMonitor.h | 2 | ||||
-rw-r--r-- | src/systemtask/SystemTask.cpp | 22 | ||||
-rw-r--r-- | src/systemtask/SystemTask.h | 2 |
3 files changed, 18 insertions, 8 deletions
diff --git a/src/systemtask/SystemMonitor.h b/src/systemtask/SystemMonitor.h index ec1fd817..029a1364 100644 --- a/src/systemtask/SystemMonitor.h +++ b/src/systemtask/SystemMonitor.h @@ -27,7 +27,7 @@ namespace Pinetime { void Process() const { if(xTaskGetTickCount() - lastTick > 10000) { NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize()); - auto nb = uxTaskGetSystemState(tasksStatus, 10, NULL); + auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr); for (uint32_t i = 0; i < nb; i++) { NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark); if (tasksStatus[i].usStackHighWaterMark < 20) diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 68f8ab53..dac4ce29 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -11,8 +11,9 @@ #include <host/ble_gap.h> #include <host/util/util.h> #include <drivers/InternalFlash.h> -#include "../main.h" +#include "main.h" #include "components/ble/NimbleController.h" +#include "../BootloaderVersion.h" using namespace Pinetime::System; @@ -36,7 +37,7 @@ SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, bleController{bleController}, dateTimeController{dateTimeController}, watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager}, nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) { - systemTaksMsgQueue = xQueueCreate(10, 1); + systemTasksMsgQueue = xQueueCreate(10, 1); } void SystemTask::Start() { @@ -100,9 +101,12 @@ void SystemTask::Work() { idleTimer = xTimerCreate ("idleTimer", idleTime, pdFALSE, this, IdleTimerCallback); xTimerStart(idleTimer, 0); + // Suppress endless loop diagnostic + #pragma clang diagnostic push + #pragma ide diagnostic ignored "EndlessLoop" while(true) { uint8_t msg; - if (xQueueReceive(systemTaksMsgQueue, &msg, isSleeping?2500 : 1000)) { + if (xQueueReceive(systemTasksMsgQueue, &msg, isSleeping ? 2500 : 1000)) { Messages message = static_cast<Messages >(msg); switch(message) { case Messages::GoToRunning: @@ -158,7 +162,11 @@ void SystemTask::Work() { ReloadIdleTimer(); break; case Messages::OnDisplayTaskSleeping: - spiNorFlash.Sleep(); + if(BootloaderVersion::IsValid()) { + // First versions of the bootloader do not expose their version and cannot initialize the SPI NOR FLASH + // if it's in sleep mode. Avoid bricked device by disabling sleep mode on these versions. + spiNorFlash.Sleep(); + } lcd.Sleep(); touchPanel.Sleep(); @@ -191,6 +199,8 @@ void SystemTask::Work() { if(!nrf_gpio_pin_read(pinButton)) watchdog.Kick(); } + // Clear diagnostic suppression + #pragma clang diagnostic pop } void SystemTask::OnButtonPushed() { @@ -228,10 +238,10 @@ void SystemTask::PushMessage(SystemTask::Messages msg) { } BaseType_t xHigherPriorityTaskWoken; xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR(systemTaksMsgQueue, &msg, &xHigherPriorityTaskWoken); + xQueueSendFromISR(systemTasksMsgQueue, &msg, &xHigherPriorityTaskWoken); if (xHigherPriorityTaskWoken) { /* Actual macro used here is port specific. */ - // TODO : should I do something here? + // TODO: should I do something here? } } diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 1be28e3f..6ef0cfbf 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -54,7 +54,7 @@ namespace Pinetime { std::unique_ptr<Pinetime::Applications::DisplayApp> displayApp; Pinetime::Controllers::Ble& bleController; Pinetime::Controllers::DateTime& dateTimeController; - QueueHandle_t systemTaksMsgQueue; + QueueHandle_t systemTasksMsgQueue; std::atomic<bool> isSleeping{false}; std::atomic<bool> isGoingToSleep{false}; std::atomic<bool> isWakingUp{false}; |