[EInkDisplay] Fix incorrect power off sequence when calling deepSleep() (#6)

This commit is contained in:
Dave Allie 2025-12-15 22:24:58 +11:00 committed by GitHub
parent 7e0dce9167
commit 4d0dcd5ff8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -521,7 +521,26 @@ void EInkDisplay::setCustomLUT(bool enabled, const unsigned char* lutData) {
}
void EInkDisplay::deepSleep() {
// Enter deep sleep mode
Serial.printf("[%lu] Preparing display for deep sleep...\n", millis());
// First, power down the display properly
// This shuts down the analog power rails and clock
if (isScreenOn) {
sendCommand(CMD_DISPLAY_UPDATE_CTRL1);
sendData(CTRL1_BYPASS_RED); // Normal mode
sendCommand(CMD_DISPLAY_UPDATE_CTRL2);
sendData(0x03); // Set ANALOG_OFF_PHASE (bit 1) and CLOCK_OFF (bit 0)
sendCommand(CMD_MASTER_ACTIVATION);
// Wait for the power-down sequence to complete
waitWhileBusy(" display power-down");
isScreenOn = false;
}
// Now enter deep sleep mode
Serial.printf("[%lu] Entering deep sleep mode...\n", millis());
sendCommand(CMD_DEEP_SLEEP);
sendData(0x01); // Enter deep sleep