SystemTask: Move lcd to DisplayApp

SystemTask should never write to the lcd
This commit is contained in:
Riku Isokoski 2023-02-25 10:05:32 +02:00
parent 6f942e20ed
commit eccea5ab9f
4 changed files with 3 additions and 8 deletions

View file

@ -129,6 +129,7 @@ void DisplayApp::InitHw() {
brightnessController.Init(); brightnessController.Init();
ApplyBrightness(); ApplyBrightness();
motorController.Init(); motorController.Init();
lcd.Init();
} }
void DisplayApp::Refresh() { void DisplayApp::Refresh() {
@ -184,10 +185,12 @@ void DisplayApp::Refresh() {
brightnessController.Lower(); brightnessController.Lower();
vTaskDelay(100); vTaskDelay(100);
} }
lcd.Sleep();
PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping); PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping);
state = States::Idle; state = States::Idle;
break; break;
case Messages::GoToRunning: case Messages::GoToRunning:
lcd.Wakeup();
ApplyBrightness(); ApplyBrightness();
state = States::Running; state = States::Running;
break; break;

View file

@ -128,7 +128,6 @@ Pinetime::Applications::DisplayApp displayApp(lcd,
fs); fs);
Pinetime::System::SystemTask systemTask(spi, Pinetime::System::SystemTask systemTask(spi,
lcd,
spiNorFlash, spiNorFlash,
twiMaster, twiMaster,
touchPanel, touchPanel,

View file

@ -49,7 +49,6 @@ void MeasureBatteryTimerCallback(TimerHandle_t xTimer) {
} }
SystemTask::SystemTask(Drivers::SpiMaster& spi, SystemTask::SystemTask(Drivers::SpiMaster& spi,
Drivers::St7789& lcd,
Pinetime::Drivers::SpiNorFlash& spiNorFlash, Pinetime::Drivers::SpiNorFlash& spiNorFlash,
Drivers::TwiMaster& twiMaster, Drivers::TwiMaster& twiMaster,
Drivers::Cst816S& touchPanel, Drivers::Cst816S& touchPanel,
@ -71,7 +70,6 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
Pinetime::Controllers::TouchHandler& touchHandler, Pinetime::Controllers::TouchHandler& touchHandler,
Pinetime::Controllers::ButtonHandler& buttonHandler) Pinetime::Controllers::ButtonHandler& buttonHandler)
: spi {spi}, : spi {spi},
lcd {lcd},
spiNorFlash {spiNorFlash}, spiNorFlash {spiNorFlash},
twiMaster {twiMaster}, twiMaster {twiMaster},
touchPanel {touchPanel}, touchPanel {touchPanel},
@ -131,7 +129,6 @@ void SystemTask::Work() {
fs.Init(); fs.Init();
nimbleController.Init(); nimbleController.Init();
lcd.Init();
twiMaster.Init(); twiMaster.Init();
/* /*
@ -232,7 +229,6 @@ void SystemTask::Work() {
xTimerStart(dimTimer, 0); xTimerStart(dimTimer, 0);
spiNorFlash.Wakeup(); spiNorFlash.Wakeup();
lcd.Wakeup();
displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning); displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning);
heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp); heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp);
@ -362,7 +358,6 @@ void SystemTask::Work() {
// if it's in sleep mode. Avoid bricked device by disabling sleep mode on these versions. // if it's in sleep mode. Avoid bricked device by disabling sleep mode on these versions.
spiNorFlash.Sleep(); spiNorFlash.Sleep();
} }
lcd.Sleep();
spi.Sleep(); spi.Sleep();
// Double Tap needs the touch screen to be in normal mode // Double Tap needs the touch screen to be in normal mode

View file

@ -55,7 +55,6 @@ namespace Pinetime {
public: public:
enum class SystemTaskState { Sleeping, Running, GoingToSleep, WakingUp }; enum class SystemTaskState { Sleeping, Running, GoingToSleep, WakingUp };
SystemTask(Drivers::SpiMaster& spi, SystemTask(Drivers::SpiMaster& spi,
Drivers::St7789& lcd,
Pinetime::Drivers::SpiNorFlash& spiNorFlash, Pinetime::Drivers::SpiNorFlash& spiNorFlash,
Drivers::TwiMaster& twiMaster, Drivers::TwiMaster& twiMaster,
Drivers::Cst816S& touchPanel, Drivers::Cst816S& touchPanel,
@ -97,7 +96,6 @@ namespace Pinetime {
TaskHandle_t taskHandle; TaskHandle_t taskHandle;
Pinetime::Drivers::SpiMaster& spi; Pinetime::Drivers::SpiMaster& spi;
Pinetime::Drivers::St7789& lcd;
Pinetime::Drivers::SpiNorFlash& spiNorFlash; Pinetime::Drivers::SpiNorFlash& spiNorFlash;
Pinetime::Drivers::TwiMaster& twiMaster; Pinetime::Drivers::TwiMaster& twiMaster;
Pinetime::Drivers::Cst816S& touchPanel; Pinetime::Drivers::Cst816S& touchPanel;