diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index ddc9be0159..bbd67fd777 100644 --- a/src/components/datetime/DateTimeController.cpp +++ b/src/components/datetime/DateTimeController.cpp @@ -117,22 +117,31 @@ void DateTime::UpdateTime(uint32_t systickCounter, bool forceUpdate) { isHourAlreadyNotified = false; } - if ((minute == 0 || minute == 30) && !isHalfHourAlreadyNotified) { + if (minute == 15 && !isQuarterHourAlreadyNotified) { + isQuarterHourAlreadyNotified = true; + if (systemTask != nullptr) { + systemTask->PushMessage(System::Messages::OnNewQuarterHour); + } + } else if (minute != 15) { + isQuarterHourAlreadyNotified = false; + } + + if (minute == 30 && !isHalfHourAlreadyNotified) { isHalfHourAlreadyNotified = true; if (systemTask != nullptr) { systemTask->PushMessage(System::Messages::OnNewHalfHour); } - } else if (minute != 0 && minute != 30) { + } else if (minute != 30) { isHalfHourAlreadyNotified = false; } - if ((minute == 0 || minute == 15 || minute == 30 || minute == 45) && !isQuarterHourAlreadyNotified) { - isQuarterHourAlreadyNotified = true; + if (minute == 45 && !isThreeQuarterHourAlreadyNotified) { + isThreeQuarterHourAlreadyNotified = true; if (systemTask != nullptr) { - systemTask->PushMessage(System::Messages::OnNewQuarterHour); + systemTask->PushMessage(System::Messages::OnNewThreeQuarterHour); } - } else if (minute != 0 && minute != 15 && minute != 30 && minute != 45) { - isQuarterHourAlreadyNotified = false; + } else if (minute != 45) { + isThreeQuarterHourAlreadyNotified = false; } // Notify new day to SystemTask diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h index 16f45fe9e9..bdf91bf83f 100644 --- a/src/components/datetime/DateTimeController.h +++ b/src/components/datetime/DateTimeController.h @@ -153,8 +153,9 @@ namespace Pinetime { bool isMidnightAlreadyNotified = false; bool isHourAlreadyNotified = true; - bool isHalfHourAlreadyNotified = true; bool isQuarterHourAlreadyNotified = true; + bool isHalfHourAlreadyNotified = true; + bool isThreeQuarterHourAlreadyNotified = true; System::SystemTask* systemTask = nullptr; Controllers::Settings& settingsController; }; diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 6671ac9e51..afbf4d4214 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -471,9 +471,33 @@ void DisplayApp::Refresh() { case Messages::BleRadioEnableToggle: PushMessageToSystemTask(System::Messages::BleRadioEnableToggle); break; - case Messages::Chime: + case Messages::FullHourChime: LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None); - motorController.RunForDuration(35); + motorController.RunForDuration(100); + break; + case Messages::QuarterHourChime: + LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None); + motorController.RunForDuration(100); + vTaskDelay(pdMS_TO_TICKS(500)); + motorController.RunForDuration(100); + break; + case Messages::HalfHourChime: + LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None); + motorController.RunForDuration(100); + vTaskDelay(pdMS_TO_TICKS(500)); + motorController.RunForDuration(100); + vTaskDelay(pdMS_TO_TICKS(500)); + motorController.RunForDuration(100); + break; + case Messages::ThreeQuarterHourChime: + LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None); + motorController.RunForDuration(100); + vTaskDelay(pdMS_TO_TICKS(500)); + motorController.RunForDuration(100); + vTaskDelay(pdMS_TO_TICKS(500)); + motorController.RunForDuration(100); + vTaskDelay(pdMS_TO_TICKS(500)); + motorController.RunForDuration(100); break; case Messages::OnChargingEvent: motorController.RunForDuration(15); diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h index d2abc8e58d..9171bd5590 100644 --- a/src/displayapp/Messages.h +++ b/src/displayapp/Messages.h @@ -22,7 +22,10 @@ namespace Pinetime { NotifyDeviceActivity, ShowPairingKey, AlarmTriggered, - Chime, + FullHourChime, + QuarterHourChime, + HalfHourChime, + ThreeQuarterHourChime, BleRadioEnableToggle, OnChargingEvent, }; diff --git a/src/systemtask/Messages.h b/src/systemtask/Messages.h index 70b8a67339..78fc28ce9e 100644 --- a/src/systemtask/Messages.h +++ b/src/systemtask/Messages.h @@ -21,8 +21,9 @@ namespace Pinetime { DisableSleeping, OnNewDay, OnNewHour, - OnNewHalfHour, OnNewQuarterHour, + OnNewHalfHour, + OnNewThreeQuarterHour, OnChargingEvent, OnPairing, SetOffAlarm, diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 9f27f49b27..fbd64bf852 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -325,7 +325,15 @@ void SystemTask::Work() { if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep && settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::Hours && !alarmController.IsAlerting()) { GoToRunning(); - displayApp.PushMessage(Pinetime::Applications::Display::Messages::Chime); + displayApp.PushMessage(Pinetime::Applications::Display::Messages::FullHourChime); + } + break; + case Messages::OnNewQuarterHour: + using Pinetime::Controllers::AlarmController; + if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep && + settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::QuarterHours && !alarmController.IsAlerting()) { + GoToRunning(); + displayApp.PushMessage(Pinetime::Applications::Display::Messages::QuarterHourChime); } break; case Messages::OnNewHalfHour: @@ -333,15 +341,15 @@ void SystemTask::Work() { if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep && settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::HalfHours && !alarmController.IsAlerting()) { GoToRunning(); - displayApp.PushMessage(Pinetime::Applications::Display::Messages::Chime); + displayApp.PushMessage(Pinetime::Applications::Display::Messages::HalfHourChime); } break; - case Messages::OnNewQuarterHour: + case Messages::OnNewThreeQuarterHour: using Pinetime::Controllers::AlarmController; if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep && settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::QuarterHours && !alarmController.IsAlerting()) { GoToRunning(); - displayApp.PushMessage(Pinetime::Applications::Display::Messages::Chime); + displayApp.PushMessage(Pinetime::Applications::Display::Messages::ThreeQuarterHourChime); } break; case Messages::OnChargingEvent: