Backup and restore vertical scroll offset when goind to sleep/wakeup to avoid scrambled display on wake-up.

This commit is contained in:
JF 2020-03-11 21:35:06 +01:00
parent b279c99488
commit a91c68c931
4 changed files with 12 additions and 9 deletions

View file

@ -132,13 +132,13 @@ void DisplayApp::Refresh() {
break; break;
case Messages::ButtonPushed: case Messages::ButtonPushed:
if(onClockApp) if(onClockApp)
systemTask.PushMessage(System::SystemTask::Messages::GoToSleep);
else {
auto buttonUsedByApp = currentScreen->OnButtonPushed();
if (!buttonUsedByApp) {
systemTask.PushMessage(System::SystemTask::Messages::GoToSleep); systemTask.PushMessage(System::SystemTask::Messages::GoToSleep);
} else { else {
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); auto buttonUsedByApp = currentScreen->OnButtonPushed();
if (!buttonUsedByApp) {
systemTask.PushMessage(System::SystemTask::Messages::GoToSleep);
} else {
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up);
} }
} }

View file

@ -131,6 +131,7 @@ void St7789::VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLin
} }
void St7789::VerticalScrollStartAddress(uint16_t line) { void St7789::VerticalScrollStartAddress(uint16_t line) {
verticalScrollingStartAddress = line;
WriteCommand(static_cast<uint8_t>(Commands::VerticalScrollStartAddress)); WriteCommand(static_cast<uint8_t>(Commands::VerticalScrollStartAddress));
WriteData(line >> 8u); WriteData(line >> 8u);
WriteData(line & 0x00ffu); WriteData(line & 0x00ffu);
@ -189,5 +190,6 @@ void St7789::Wakeup() {
RowAddressSet(); RowAddressSet();
DisplayInversionOn(); DisplayInversionOn();
NormalModeOn(); NormalModeOn();
VerticalScrollStartAddress(verticalScrollingStartAddress);
DisplayOn(); DisplayOn();
} }

View file

@ -31,6 +31,7 @@ namespace Pinetime {
private: private:
SpiMaster& spi; SpiMaster& spi;
uint8_t pinDataCommand; uint8_t pinDataCommand;
uint8_t verticalScrollingStartAddress = 0;
void HardwareReset(); void HardwareReset();
void SoftwareReset(); void SoftwareReset();

View file

@ -8452,15 +8452,15 @@
// <e> NRF_LOG_ENABLED - nrf_log - Logger // <e> NRF_LOG_ENABLED - nrf_log - Logger
//========================================================== //==========================================================
#ifndef NRF_LOG_ENABLED #ifndef NRF_LOG_ENABLED
#define NRF_LOG_ENABLED 1 #define NRF_LOG_ENABLED 0
#endif #endif
#ifndef NRF_LOG_BACKEND_RTT_ENABLED #ifndef NRF_LOG_BACKEND_RTT_ENABLED
#define NRF_LOG_BACKEND_RTT_ENABLED 1 #define NRF_LOG_BACKEND_RTT_ENABLED 0
#endif #endif
#ifndef NRF_LOG_BACKEND_SERIAL_USES_RTT #ifndef NRF_LOG_BACKEND_SERIAL_USES_RTT
#define NRF_LOG_BACKEND_SERIAL_USES_RTT 1 #define NRF_LOG_BACKEND_SERIAL_USES_RTT 0
#endif #endif
// <h> Log message pool - Configuration of log message pool // <h> Log message pool - Configuration of log message pool