Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chime vibration patterns and 15 minute option #2227

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/components/datetime/DateTimeController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,33 @@ 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 == 45 && !isThreeQuarterHourAlreadyNotified) {
isThreeQuarterHourAlreadyNotified = true;
if (systemTask != nullptr) {
systemTask->PushMessage(System::Messages::OnNewThreeQuarterHour);
}
} else if (minute != 45) {
isThreeQuarterHourAlreadyNotified = false;
}

// Notify new day to SystemTask
if (hour == 0 and not isMidnightAlreadyNotified) {
isMidnightAlreadyNotified = true;
Expand Down
2 changes: 2 additions & 0 deletions src/components/datetime/DateTimeController.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ namespace Pinetime {

bool isMidnightAlreadyNotified = false;
bool isHourAlreadyNotified = true;
bool isQuarterHourAlreadyNotified = true;
bool isHalfHourAlreadyNotified = true;
bool isThreeQuarterHourAlreadyNotified = true;
System::SystemTask* systemTask = nullptr;
Controllers::Settings& settingsController;
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Pinetime {
enum class ClockType : uint8_t { H24, H12 };
enum class WeatherFormat : uint8_t { Metric, Imperial };
enum class Notification : uint8_t { On, Off, Sleep };
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
enum class ChimesOption : uint8_t { None, Hours, HalfHours, QuarterHours };
enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 };
enum class Colors : uint8_t {
White,
Expand Down
28 changes: 26 additions & 2 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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::QuarterHourChime:
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
motorController.RunForDuration(100);
break;
case Messages::HalfHourChime:
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
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);
break;
case Messages::OnChargingEvent:
motorController.RunForDuration(15);
Expand Down
5 changes: 4 additions & 1 deletion src/displayapp/Messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ namespace Pinetime {
NotifyDeviceActivity,
ShowPairingKey,
AlarmTriggered,
Chime,
FullHourChime,
QuarterHourChime,
HalfHourChime,
ThreeQuarterHourChime,
BleRadioEnableToggle,
OnChargingEvent,
};
Expand Down
3 changes: 2 additions & 1 deletion src/displayapp/screens/settings/SettingChimes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ namespace {
const char* name;
};

constexpr std::array<Option, 3> options = {{
constexpr std::array<Option, 4> options = {{
{Pinetime::Controllers::Settings::ChimesOption::None, "Off"},
{Pinetime::Controllers::Settings::ChimesOption::Hours, "Every hour"},
{Pinetime::Controllers::Settings::ChimesOption::HalfHours, "Every 30 mins"},
{Pinetime::Controllers::Settings::ChimesOption::QuarterHours, "Every 15 mins"},
}};

std::array<CheckboxList::Item, CheckboxList::MaxItems> CreateOptionArray() {
Expand Down
2 changes: 2 additions & 0 deletions src/systemtask/Messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ namespace Pinetime {
DisableSleeping,
OnNewDay,
OnNewHour,
OnNewQuarterHour,
OnNewHalfHour,
OnNewThreeQuarterHour,
OnChargingEvent,
OnPairing,
SetOffAlarm,
Expand Down
26 changes: 22 additions & 4 deletions src/systemtask/SystemTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,17 +323,35 @@ void SystemTask::Work() {
case Messages::OnNewHour:
using Pinetime::Controllers::AlarmController;
if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep &&
settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::Hours && !alarmController.IsAlerting()) {
settingsController.GetChimeOption() != Controllers::Settings::ChimesOption::None && !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:
using Pinetime::Controllers::AlarmController;
if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep &&
settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::HalfHours && !alarmController.IsAlerting()) {
(settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::HalfHours ||
settingsController.GetChimeOption() == Controllers::Settings::ChimesOption::QuarterHours) &&
!alarmController.IsAlerting()) {
GoToRunning();
displayApp.PushMessage(Pinetime::Applications::Display::Messages::HalfHourChime);
}
break;
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:
Expand Down
Loading