aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crawford <coffeeboi47@protonmail.com>2023-10-14 10:16:49 -0600
committerJF <JF002@users.noreply.github.com>2024-08-05 20:32:43 +0200
commit5385f7e275a0b3ca83d8a7cae959b02700ef153a (patch)
treecc0289f2324aa00bf8b705ba5f31eab007ab1d69
parente884b053d32d4a7c3b4464e07edaddfbb334ec27 (diff)
aod: switch to 8 colors when always on
-rw-r--r--src/displayapp/DisplayApp.cpp7
-rw-r--r--src/drivers/St7789.cpp18
-rw-r--r--src/drivers/St7789.h6
3 files changed, 30 insertions, 1 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 5e68ef23..1a579cb1 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -249,6 +249,7 @@ void DisplayApp::Refresh() {
// Don't actually turn off the display for AlwaysOn mode
if (settingsController.GetAlwaysOnDisplay()) {
brightnessController.Set(Controllers::BrightnessController::Levels::AlwaysOn);
+ lcd.LowPowerOn();
} else {
brightnessController.Set(Controllers::BrightnessController::Levels::Off);
lcd.Sleep();
@@ -257,7 +258,11 @@ void DisplayApp::Refresh() {
state = States::Idle;
break;
case Messages::GoToRunning:
- lcd.Wakeup();
+ if (settingsController.GetAlwaysOnDisplay()) {
+ lcd.LowPowerOff();
+ } else {
+ lcd.Wakeup();
+ }
lv_disp_trig_activity(nullptr);
ApplyBrightness();
state = States::Running;
diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp
index c22f2199..274e2b62 100644
--- a/src/drivers/St7789.cpp
+++ b/src/drivers/St7789.cpp
@@ -127,6 +127,14 @@ void St7789::NormalModeOn() {
WriteCommand(static_cast<uint8_t>(Commands::NormalModeOn));
}
+void St7789::IdleModeOn() {
+ WriteCommand(static_cast<uint8_t>(Commands::IdleModeOn));
+}
+
+void St7789::IdleModeOff() {
+ WriteCommand(static_cast<uint8_t>(Commands::IdleModeOff));
+}
+
void St7789::DisplayOn() {
WriteCommand(static_cast<uint8_t>(Commands::DisplayOn));
}
@@ -198,6 +206,16 @@ void St7789::HardwareReset() {
vTaskDelay(pdMS_TO_TICKS(125));
}
+void St7789::LowPowerOn() {
+ IdleModeOn();
+ NRF_LOG_INFO("[LCD] Low power mode");
+}
+
+void St7789::LowPowerOff() {
+ IdleModeOff();
+ NRF_LOG_INFO("[LCD] Normal power mode");
+}
+
void St7789::Sleep() {
SleepIn();
nrf_gpio_cfg_default(pinDataCommand);
diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h
index 844e0180..ccc951ff 100644
--- a/src/drivers/St7789.h
+++ b/src/drivers/St7789.h
@@ -24,6 +24,8 @@ namespace Pinetime {
void DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data, size_t size);
+ void LowPowerOn();
+ void LowPowerOff();
void Sleep();
void Wakeup();
@@ -45,6 +47,8 @@ namespace Pinetime {
void DisplayInversionOn();
void NormalModeOn();
void WriteToRam(const uint8_t* data, size_t size);
+ void IdleModeOn();
+ void IdleModeOff();
void DisplayOn();
void DisplayOff();
@@ -68,6 +72,8 @@ namespace Pinetime {
MemoryDataAccessControl = 0x36,
VerticalScrollDefinition = 0x33,
VerticalScrollStartAddress = 0x37,
+ IdleModeOff = 0x38,
+ IdleModeOn = 0x39,
PixelFormat = 0x3a,
VdvSet = 0xc4,
};