diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-17 13:47:47 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-17 13:47:47 (GMT) |
| commit | 9f062635af3548425102b976e26ebbdfa998d670 (patch) | |
| tree | 6f96c7c9a56308c314c187d3639b1054255e06d8 | |
| parent | ee9dc8f79eaada3ef5ffdcb4bab9bfe8c2219d0b (diff) | |
| parent | aca605d4fb4040cc80c1acf101023aa86e7694ba (diff) | |
Merge branch 'alarm-reliability-and-switch-to-freertos-timers' into edge
# Conflicts:
# src/components/alarm/AlarmController.cpp
# src/components/datetime/DateTimeController.cpp
# src/components/motor/MotorController.cpp
# src/components/timer/TimerController.cpp
# src/components/timer/TimerController.h
# src/systemtask/Messages.h
# src/systemtask/SystemTask.cpp
| -rw-r--r-- | src/components/datetime/DateTimeController.cpp | 20 | ||||
| -rw-r--r-- | src/components/motor/MotorController.cpp | 3 | ||||
| -rw-r--r-- | src/components/timer/TimerController.cpp | 3 | ||||
| -rw-r--r-- | src/components/timer/TimerController.h | 1 | ||||
| -rw-r--r-- | src/systemtask/SystemTask.cpp | 2 |
5 files changed, 15 insertions, 14 deletions
diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index 76407f0..3d7df5a 100644 --- a/src/components/datetime/DateTimeController.cpp +++ b/src/components/datetime/DateTimeController.cpp @@ -133,16 +133,16 @@ std::string DateTime::FormattedTime() { // Return time as a string in 12- or 24-hour format char buff[9]; if (settingsController.GetClockType() == ClockType::H12) { - uint8_t hour12; - const char* amPmStr; - if (hour < 12) { - hour12 = (hour == 0) ? 12 : hour; - amPmStr = "AM"; - } else { - hour12 = (hour == 12) ? 12 : hour - 12; - amPmStr = "PM"; - } - sprintf(buff, "%i:%02i %s", hour12, minute, amPmStr); + uint8_t hour12; + const char* amPmStr; + if (hour < 12) { + hour12 = (hour == 0) ? 12 : hour; + amPmStr = "AM"; + } else { + hour12 = (hour == 12) ? 12 : hour - 12; + amPmStr = "PM"; + } + sprintf(buff, "%i:%02i %s", hour12, minute, amPmStr); } else { sprintf(buff, "%02i:%02i", hour, minute); } diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index 547d87b..4c44fc4 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -24,8 +24,7 @@ void MotorController::Ring(TimerHandle_t xTimer) { } void MotorController::RunForDuration(uint8_t motorDuration) { - if (xTimerChangePeriod(shortVibTimer, APP_TIMER_TICKS(motorDuration), 0) == pdPASS - && xTimerStart(shortVibTimer, 0) == pdPASS) { + if (xTimerChangePeriod(shortVibTimer, APP_TIMER_TICKS(motorDuration), 0) == pdPASS && xTimerStart(shortVibTimer, 0) == pdPASS) { nrf_gpio_pin_clear(PinMap::Motor); } } diff --git a/src/components/timer/TimerController.cpp b/src/components/timer/TimerController.cpp index 9802ded..9456909 100644 --- a/src/components/timer/TimerController.cpp +++ b/src/components/timer/TimerController.cpp @@ -21,7 +21,7 @@ void TimerController::Init(System::SystemTask* systemTask) { } void TimerController::StartTimer(uint32_t duration) { - xTimerStop(timerAppTimer,0); + xTimerStop(timerAppTimer, 0); auto currentTicks = xTaskGetTickCount(); TickType_t durationTicks = APP_TIMER_TICKS(duration); xTimerChangePeriod(timerAppTimer, durationTicks, 0); @@ -60,3 +60,4 @@ void TimerController::OnTimerEnd() { systemTask->PushMessage(System::Messages::OnTimerDone); } } + diff --git a/src/components/timer/TimerController.h b/src/components/timer/TimerController.h index cdd78ec..b1b8d3c 100644 --- a/src/components/timer/TimerController.h +++ b/src/components/timer/TimerController.h @@ -28,6 +28,7 @@ namespace Pinetime { } void OnTimerEnd(); + protected: friend class Pinetime::System::SystemTask; void Init(System::SystemTask* systemTask); diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 5a0a99d..14e4dbe 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -456,7 +456,7 @@ void SystemTask::Work() { displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowPairingKey); break; case Messages::BleRadioEnableToggle: - if(settingsController.GetBleRadioEnabled()) { + if (settingsController.GetBleRadioEnabled()) { nimbleController.EnableRadio(); } else { nimbleController.DisableRadio(); |
