Skip to content

Commit 5385f7e

Browse files
KaffeinatedKatJF002
authored andcommitted
aod: switch to 8 colors when always on
1 parent e884b05 commit 5385f7e

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/displayapp/DisplayApp.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ void DisplayApp::Refresh() {
249249
// Don't actually turn off the display for AlwaysOn mode
250250
if (settingsController.GetAlwaysOnDisplay()) {
251251
brightnessController.Set(Controllers::BrightnessController::Levels::AlwaysOn);
252+
lcd.LowPowerOn();
252253
} else {
253254
brightnessController.Set(Controllers::BrightnessController::Levels::Off);
254255
lcd.Sleep();
@@ -257,7 +258,11 @@ void DisplayApp::Refresh() {
257258
state = States::Idle;
258259
break;
259260
case Messages::GoToRunning:
260-
lcd.Wakeup();
261+
if (settingsController.GetAlwaysOnDisplay()) {
262+
lcd.LowPowerOff();
263+
} else {
264+
lcd.Wakeup();
265+
}
261266
lv_disp_trig_activity(nullptr);
262267
ApplyBrightness();
263268
state = States::Running;

src/drivers/St7789.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ void St7789::NormalModeOn() {
127127
WriteCommand(static_cast<uint8_t>(Commands::NormalModeOn));
128128
}
129129

130+
void St7789::IdleModeOn() {
131+
WriteCommand(static_cast<uint8_t>(Commands::IdleModeOn));
132+
}
133+
134+
void St7789::IdleModeOff() {
135+
WriteCommand(static_cast<uint8_t>(Commands::IdleModeOff));
136+
}
137+
130138
void St7789::DisplayOn() {
131139
WriteCommand(static_cast<uint8_t>(Commands::DisplayOn));
132140
}
@@ -198,6 +206,16 @@ void St7789::HardwareReset() {
198206
vTaskDelay(pdMS_TO_TICKS(125));
199207
}
200208

209+
void St7789::LowPowerOn() {
210+
IdleModeOn();
211+
NRF_LOG_INFO("[LCD] Low power mode");
212+
}
213+
214+
void St7789::LowPowerOff() {
215+
IdleModeOff();
216+
NRF_LOG_INFO("[LCD] Normal power mode");
217+
}
218+
201219
void St7789::Sleep() {
202220
SleepIn();
203221
nrf_gpio_cfg_default(pinDataCommand);

src/drivers/St7789.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ namespace Pinetime {
2424

2525
void DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data, size_t size);
2626

27+
void LowPowerOn();
28+
void LowPowerOff();
2729
void Sleep();
2830
void Wakeup();
2931

@@ -45,6 +47,8 @@ namespace Pinetime {
4547
void DisplayInversionOn();
4648
void NormalModeOn();
4749
void WriteToRam(const uint8_t* data, size_t size);
50+
void IdleModeOn();
51+
void IdleModeOff();
4852
void DisplayOn();
4953
void DisplayOff();
5054

@@ -68,6 +72,8 @@ namespace Pinetime {
6872
MemoryDataAccessControl = 0x36,
6973
VerticalScrollDefinition = 0x33,
7074
VerticalScrollStartAddress = 0x37,
75+
IdleModeOff = 0x38,
76+
IdleModeOn = 0x39,
7177
PixelFormat = 0x3a,
7278
VdvSet = 0xc4,
7379
};

0 commit comments

Comments
 (0)