diff options
| author | JF <JF002@users.noreply.github.com> | 2022-01-04 20:44:36 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-04 20:44:36 (GMT) |
| commit | b8b54f47a2a09e32186bf7d8dddc658fae2c6e5f (patch) | |
| tree | 2b0d3f4873b54c388aa27d897e710665c857d321 /src/components/datetime/DateTimeController.cpp | |
| parent | e0013e730448f4dc142e3610f970f22c807ac41e (diff) | |
| parent | 15c3807a761b00a6dcdcc3a516e67e584f0a55c9 (diff) | |
Merge pull request #813 from SteveAmor/chimes
Chimes option
Diffstat (limited to 'src/components/datetime/DateTimeController.cpp')
| -rw-r--r-- | src/components/datetime/DateTimeController.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index 4ac9e1f..673903c 100644 --- a/src/components/datetime/DateTimeController.cpp +++ b/src/components/datetime/DateTimeController.cpp @@ -75,6 +75,24 @@ void DateTime::UpdateTime(uint32_t systickCounter) { minute = time.minutes().count(); second = time.seconds().count(); + if (minute == 0 && !isHourAlreadyNotified) { + isHourAlreadyNotified = true; + if (systemTask != nullptr) { + systemTask->PushMessage(System::Messages::OnNewHour); + } + } else if (minute != 0) { + isHourAlreadyNotified = false; + } + + if ((minute == 0 || minute == 30) && !isHalfHourAlreadyNotified) { + isHalfHourAlreadyNotified = true; + if (systemTask != nullptr) { + systemTask->PushMessage(System::Messages::OnNewHalfHour); + } + } else if (minute != 0 && minute != 30) { + isHalfHourAlreadyNotified = false; + } + // Notify new day to SystemTask if (hour == 0 and not isMidnightAlreadyNotified) { isMidnightAlreadyNotified = true; @@ -100,4 +118,3 @@ const char* DateTime::MonthShortToStringLow(Months month) { void DateTime::Register(Pinetime::System::SystemTask* systemTask) { this->systemTask = systemTask; } - |
