Created basic alarm app

This commit is contained in:
Mark Russell
2021-09-10 18:40:13 -04:00
parent 6f9f0e8b0e
commit 1fb5757655
16 changed files with 480 additions and 3 deletions

View File

@@ -57,6 +57,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
Controllers::Ble& bleController,
Controllers::DateTime& dateTimeController,
Controllers::TimerController& timerController,
Controllers::AlarmController& alarmController,
Drivers::Watchdog& watchdog,
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::MotorController& motorController,
@@ -79,6 +80,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
bleController {bleController},
dateTimeController {dateTimeController},
timerController {timerController},
alarmController {alarmController},
watchdog {watchdog},
notificationManager {notificationManager},
motorController {motorController},
@@ -132,6 +134,8 @@ void SystemTask::Work() {
motionSensor.SoftReset();
timerController.Register(this);
timerController.Init();
alarmController.Register(this);
alarmController.Init();
// Reset the TWI device because the motion sensor chip most probably crashed it...
twiMaster.Sleep();
@@ -275,6 +279,16 @@ void SystemTask::Work() {
motorController.RunForDuration(35);
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TimerDone);
break;
case Messages::SetOffAlarm:
if (isSleeping && !isWakingUp) {
GoToRunning();
}
motorController.StartRingingDisregardSettings();
displayApp.PushMessage(Pinetime::Applications::Display::Messages::AlarmTriggered);
break;
case Messages::StopRinging:
motorController.StopRinging();
break;
case Messages::BleConnected:
ReloadIdleTimer();
isBleDiscoveryTimerRunning = true;