InfiniTime.git

commit 5040733a97560f8f0ef73f7df7982c5acaf15b47

Author: mark9064 <30447455+mark9064@users.noreply.github.com>

Clean unused DisplayApp messages

 src/displayapp/DisplayApp.cpp | 32 +++++---------------------------
 src/displayapp/Messages.h | 4 ++--
 src/systemtask/SystemTask.cpp | 5 -----


diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 3be7656dc8c15bff9d348d89d21bf46e6ab4360d..795196216f092309ffb30f891b93a8e197ceb8c7 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -209,21 +209,6 @@     }
     LoadScreen(returnAppStack.Pop(), returnDirection);
   };
 
-  auto DimScreen = [this]() {
-    if (brightnessController.Level() != Controllers::BrightnessController::Levels::Off) {
-      isDimmed = true;
-      brightnessController.Set(Controllers::BrightnessController::Levels::Low);
-    }
-  };
-
-  auto RestoreBrightness = [this]() {
-    if (brightnessController.Level() != Controllers::BrightnessController::Levels::Off) {
-      isDimmed = false;
-      lv_disp_trig_activity(nullptr);
-      ApplyBrightness();
-    }
-  };
-
   auto IsPastDimTime = [this]() -> bool {
     return lv_disp_get_inactive_time(nullptr) >= pdMS_TO_TICKS(settingsController.GetScreenTimeOut() - 2000);
   };
@@ -267,14 +252,16 @@       queueTimeout = lv_task_handler();
 
       if (!systemTask->IsSleepDisabled() && IsPastDimTime()) {
         if (!isDimmed) {
-          DimScreen();
+          isDimmed = true;
+          brightnessController.Set(Controllers::BrightnessController::Levels::Low);
         }
         if (IsPastSleepTime()) {
           systemTask->PushMessage(System::Messages::GoToSleep);
           state = States::Idle;
         }
       } else if (isDimmed) {
-        RestoreBrightness();
+        isDimmed = false;
+        ApplyBrightness();
       }
       break;
     default:
@@ -285,9 +272,6 @@
   Messages msg;
   if (xQueueReceive(msgQueue, &msg, queueTimeout) == pdTRUE) {
     switch (msg) {
-      case Messages::DimScreen:
-        DimScreen();
-        break;
       case Messages::GoToSleep:
         while (brightnessController.Level() != Controllers::BrightnessController::Levels::Low) {
           brightnessController.Lower();
@@ -333,8 +317,7 @@         ApplyBrightness();
         state = States::Running;
         break;
       case Messages::UpdateBleConnection:
-        //        clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected :
-        //        Screens::Clock::BleConnectionStates::NotConnected);
+        // Only used for recovery firmware
         break;
       case Messages::NewNotification:
         LoadNewScreen(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down);
@@ -449,16 +432,11 @@         break;
       case Messages::BleRadioEnableToggle:
         PushMessageToSystemTask(System::Messages::BleRadioEnableToggle);
         break;
-      case Messages::UpdateDateTime:
-        // Added to remove warning
-        // What should happen here?
-        break;
       case Messages::Chime:
         LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
         motorController.RunForDuration(35);
         break;
       case Messages::OnChargingEvent:
-        RestoreBrightness();
         motorController.RunForDuration(15);
         break;
     }




diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h
index 1418f6bea0e998b90cc0d16022baba7b76d2f3ba..dcfff4c2974ef844470f7d9cdccf7c41a695a85c 100644
--- a/src/displayapp/Messages.h
+++ b/src/displayapp/Messages.h
@@ -7,7 +7,6 @@     namespace Display {
       enum class Messages : uint8_t {
         GoToSleep,
         GoToRunning,
-        UpdateDateTime,
         UpdateBleConnection,
         TouchEvent,
         ButtonPushed,
@@ -17,7 +16,8 @@         ButtonDoubleClicked,
         NewNotification,
         TimerDone,
         BleFirmwareUpdateStarted,
-        DimScreen,
+        // Resets the screen timeout timer when awake
+        // Does nothing when asleep
         NotifyDeviceActivity,
         ShowPairingKey,
         AlarmTriggered,




diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp
index 211e19ec8133aa192c3a855123bf3c11478b10a5..848fb54c27f06feb90203af8297967c12e5b7267 100644
--- a/src/systemtask/SystemTask.cpp
+++ b/src/systemtask/SystemTask.cpp
@@ -194,7 +194,6 @@           // if the exiting was caused by a firmware update
           if (!bleController.IsFirmwareUpdating()) {
             doNotGoToSleep = false;
           }
-          displayApp.PushMessage(Pinetime::Applications::Display::Messages::NotifyDeviceActivity);
           break;
         case Messages::DisableSleeping:
           doNotGoToSleep = true;
@@ -245,8 +244,6 @@           displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToSleep);
           heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::GoToSleep);
           break;
         case Messages::OnNewTime:
-          displayApp.PushMessage(Pinetime::Applications::Display::Messages::NotifyDeviceActivity);
-          displayApp.PushMessage(Pinetime::Applications::Display::Messages::UpdateDateTime);
           if (alarmController.State() == Controllers::AlarmController::AlarmState::Set) {
             alarmController.ScheduleAlarm();
           }
@@ -255,8 +252,6 @@         case Messages::OnNewNotification:
           if (settingsController.GetNotificationStatus() == Pinetime::Controllers::Settings::Notification::On) {
             if (state == SystemTaskState::Sleeping) {
               GoToRunning();
-            } else {
-              displayApp.PushMessage(Pinetime::Applications::Display::Messages::NotifyDeviceActivity);
             }
             displayApp.PushMessage(Pinetime::Applications::Display::Messages::NewNotification);
           }