Skip to content

Commit 66e4b16

Browse files
committed
chimes: Add chime option for every quarter hour
1 parent 3e23ee7 commit 66e4b16

File tree

6 files changed

+22
-2
lines changed

6 files changed

+22
-2
lines changed

src/components/datetime/DateTimeController.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ void DateTime::UpdateTime(uint32_t systickCounter, bool forceUpdate) {
126126
isHalfHourAlreadyNotified = false;
127127
}
128128

129+
if ((minute == 0 || minute == 15 || minute == 30 || minute == 45) && !isQuarterHourAlreadyNotified) {
130+
isQuarterHourAlreadyNotified = true;
131+
if (systemTask != nullptr) {
132+
systemTask->PushMessage(System::Messages::OnNewQuarterHour);
133+
}
134+
} else if (minute != 0 && minute != 15 && minute != 30 && minute != 45) {
135+
isQuarterHourAlreadyNotified = false;
136+
}
137+
129138
// Notify new day to SystemTask
130139
if (hour == 0 and not isMidnightAlreadyNotified) {
131140
isMidnightAlreadyNotified = true;

src/components/datetime/DateTimeController.h

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ namespace Pinetime {
154154
bool isMidnightAlreadyNotified = false;
155155
bool isHourAlreadyNotified = true;
156156
bool isHalfHourAlreadyNotified = true;
157+
bool isQuarterHourAlreadyNotified = true;
157158
System::SystemTask* systemTask = nullptr;
158159
Controllers::Settings& settingsController;
159160
};

src/components/settings/Settings.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Pinetime {
1212
enum class ClockType : uint8_t { H24, H12 };
1313
enum class WeatherFormat : uint8_t { Metric, Imperial };
1414
enum class Notification : uint8_t { On, Off, Sleep };
15-
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
15+
enum class ChimesOption : uint8_t { None, Hours, HalfHours, QuarterHours };
1616
enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 };
1717
enum class Colors : uint8_t {
1818
White,

src/displayapp/screens/settings/SettingChimes.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ namespace {
1414
const char* name;
1515
};
1616

17-
constexpr std::array<Option, 3> options = {{
17+
constexpr std::array<Option, 4> options = {{
1818
{Pinetime::Controllers::Settings::ChimesOption::None, "Off"},
1919
{Pinetime::Controllers::Settings::ChimesOption::Hours, "Every hour"},
2020
{Pinetime::Controllers::Settings::ChimesOption::HalfHours, "Every 30 mins"},
21+
{Pinetime::Controllers::Settings::ChimesOption::QuarterHours, "Every 15 mins"},
2122
}};
2223

2324
std::array<CheckboxList::Item, CheckboxList::MaxItems> CreateOptionArray() {

src/systemtask/Messages.h

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace Pinetime {
2222
OnNewDay,
2323
OnNewHour,
2424
OnNewHalfHour,
25+
OnNewQuarterHour,
2526
OnChargingEvent,
2627
OnPairing,
2728
SetOffAlarm,

src/systemtask/SystemTask.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,14 @@ void SystemTask::Work() {
336336
displayApp.PushMessage(Pinetime::Applications::Display::Messages::Chime);
337337
}
338338
break;
339+
case Messages::OnNewQuarterHour:
340+
using Pinetime::Controllers::AlarmController;
341+
if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep &&
342+
settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::QuarterHours && !alarmController.IsAlerting()) {
343+
GoToRunning();
344+
displayApp.PushMessage(Pinetime::Applications::Display::Messages::Chime);
345+
}
346+
break;
339347
case Messages::OnChargingEvent:
340348
batteryController.ReadPowerState();
341349
GoToRunning();

0 commit comments

Comments
 (0)