diff options
| author | JF <jf@codingfield.com> | 2022-04-02 14:34:53 (GMT) |
|---|---|---|
| committer | Gitea <gitea@fake.local> | 2022-04-02 14:34:53 (GMT) |
| commit | 187ea0f06d93c7f7df5779cb321a28ad040234ee (patch) | |
| tree | 3d6d1b2f60573045734153d975e9b0aa1b327394 /src/systemtask/SystemTask.cpp | |
| parent | adc7909c9823c5cd9fc9888a84e84f9182b9088f (diff) | |
| parent | b498e1d633522eed975d78b04508834b7a79befe (diff) | |
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/systemtask/SystemTask.cpp')
| -rw-r--r-- | src/systemtask/SystemTask.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 94d40c9..77cf411 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -1,18 +1,10 @@ #include "systemtask/SystemTask.h" -#define min // workaround: nimble's min/max macros conflict with libstdc++ -#define max -#include <host/ble_gap.h> -#include <host/ble_gatt.h> -#include <host/ble_hs_adv.h> -#include <host/util/util.h> -#include <nimble/hci_common.h> -#undef max -#undef min #include <hal/nrf_rtc.h> #include <libraries/gpiote/app_gpiote.h> #include <libraries/log/nrf_log.h> #include "BootloaderVersion.h" +#include "components/battery/BatteryController.h" #include "components/ble/BleController.h" #include "drivers/Cst816s.h" #include "drivers/St7789.h" @@ -115,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); } } @@ -197,13 +189,13 @@ void SystemTask::Work() { // Touchscreen nrf_gpio_cfg_sense_input(PinMap::Cst816sIrq, static_cast<nrf_gpio_pin_pull_t>(GPIO_PIN_CNF_PULL_Pullup), - static_cast<nrf_gpio_pin_sense_t> GPIO_PIN_CNF_SENSE_Low); + static_cast<nrf_gpio_pin_sense_t>(GPIO_PIN_CNF_SENSE_Low)); pinConfig.skip_gpio_setup = true; pinConfig.hi_accuracy = false; pinConfig.is_watcher = false; pinConfig.sense = static_cast<nrf_gpiote_polarity_t>(NRF_GPIOTE_POLARITY_HITOLO); - pinConfig.pull = static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Pullup; + pinConfig.pull = static_cast<nrf_gpio_pin_pull_t>(GPIO_PIN_CNF_PULL_Pullup); nrfx_gpiote_in_init(PinMap::Cst816sIrq, &pinConfig, nrfx_gpiote_evt_handler); @@ -239,6 +231,7 @@ void SystemTask::Work() { if (!bleController.IsFirmwareUpdating()) { doNotGoToSleep = false; } + ReloadIdleTimer(); break; case Messages::DisableSleeping: doNotGoToSleep = true; @@ -261,7 +254,7 @@ void SystemTask::Work() { displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning); heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp); - if (!bleController.IsConnected()) { + if (bleController.IsRadioEnabled() && !bleController.IsConnected()) { nimbleController.RestartFastAdv(); } @@ -295,6 +288,9 @@ void SystemTask::Work() { case Messages::OnNewTime: ReloadIdleTimer(); displayApp.PushMessage(Pinetime::Applications::Display::Messages::UpdateDateTime); + if (alarmController.State() == Controllers::AlarmController::AlarmState::Set) { + alarmController.ScheduleAlarm(); + } break; case Messages::OnNewNotification: if (settingsController.GetNotificationStatus() == Pinetime::Controllers::Settings::Notification::ON) { @@ -444,7 +440,13 @@ void SystemTask::Work() { motorController.RunForDuration(35); displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowPairingKey); break; - + case Messages::BleRadioEnableToggle: + if(settingsController.GetBleRadioEnabled()) { + nimbleController.EnableRadio(); + } else { + nimbleController.DisableRadio(); + } + break; default: break; } |
