summaryrefslogtreecommitdiff
path: root/src/components/datetime
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/datetime')
-rw-r--r--src/components/datetime/DateTimeController.cpp14
-rw-r--r--src/components/datetime/DateTimeController.h5
2 files changed, 11 insertions, 8 deletions
diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp
index fbaa01b..01e2859 100644
--- a/src/components/datetime/DateTimeController.cpp
+++ b/src/components/datetime/DateTimeController.cpp
@@ -38,7 +38,7 @@ void DateTime::SetTime(
UpdateTime(systickCounter);
NRF_LOG_INFO("* %d %d %d ", this->hour, this->minute, this->second);
- NRF_LOG_INFO("* %d %d %d ", this->day, this->month, this->year);
+ NRF_LOG_INFO("* %d %d %d ", this->day, ((int)this->month), this->year);
systemTask->PushMessage(System::Messages::OnNewTime);
}
@@ -82,15 +82,15 @@ void DateTime::UpdateTime(uint32_t systickCounter) {
isHourAlreadyNotified = false;
}
- if ((minute == 0 || minute == 30) && !isHalfHourAlreadyNotified) {
- isHalfHourAlreadyNotified = true;
+ if (minute%chimePeriod) {
+ hasChimed = false;
+ } else if (!hasChimed) {
if (systemTask != nullptr) {
- systemTask->PushMessage(System::Messages::OnNewHalfHour);
+ systemTask->PushMessage(System::Messages::OnChime);
+ hasChimed = true;
}
- } else if (minute != 0 && minute != 30) {
- isHalfHourAlreadyNotified = false;
}
-
+
// Notify new day to SystemTask
if (hour == 0 and not isMidnightAlreadyNotified) {
isMidnightAlreadyNotified = true;
diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h
index 2126ca1..ca7320c 100644
--- a/src/components/datetime/DateTimeController.h
+++ b/src/components/datetime/DateTimeController.h
@@ -97,7 +97,10 @@ namespace Pinetime {
bool isMidnightAlreadyNotified = false;
bool isHourAlreadyNotified = true;
- bool isHalfHourAlreadyNotified = true;
+ bool hasChimed = true;
+ public:
+ uint8_t chimePeriod = 5;
+ private:
System::SystemTask* systemTask = nullptr;
Controllers::Settings& settingsController;
};