diff --git a/platformio.ini b/platformio.ini index effae4e..36b3bf8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -53,10 +53,12 @@ default_envs = [env] lib_deps = ; Pinned: bb_epaper has no releases, so an unpinned URL means CI and local - ; builds get whatever HEAD was at install time. 5dccfbb is "Added support for + ; builds get whatever HEAD was at install time. Full SHA required: PlatformIO + ; shallow-fetches the #ref (`git fetch --depth=1 origin `), and GitHub + ; does not resolve abbreviated SHAs as refs. 5dccfbbf… is "Added support for ; the Seeed reTerminal E1004 and its 13.3 Spectra6 1200x1600 panel" -- the ; commit that landed E1004 upstream, replacing the limengdu fork pin. - https://github.com/bitbank2/bb_epaper.git#5dccfbb + https://github.com/bitbank2/bb_epaper.git#5dccfbbf553a9b0fe2547cbc4e60138e1ff2fb43 h2zero/NimBLE-Arduino@^2.5.0 extra_scripts = pre:scripts/factory_config_gen.py diff --git a/src/display_service.cpp b/src/display_service.cpp index 0ed04bd..c5fa58c 100644 --- a/src/display_service.cpp +++ b/src/display_service.cpp @@ -337,6 +337,24 @@ static void pwrmgmLockGive(void) { __atomic_store_n(&pwrmgmLock, 0, __ATOMIC_RELEASE); } +// After controller power-off / deep-sleep, wait before cutting VDD so board boost +// caps and VCOM can bleed. 50 ms was too short on EP42B (panel_ic 2 / SSD16xx): +// refresh looked correct, then the image darkened in over the following minutes. +static const uint16_t EPD_POST_SLEEP_BLEED_MS = 200; + +// SSD16xx bbepSleep() only sends deep-sleep; it does not run the analog/HV +// shutdown. Force EOPT discharge frames + the GoodDisplay/GxEPD2 power-off +// sequence (enable clock → disable analog → disable OSC) while SPI is still up. +static void epdSsd16xxPowerOffDischarge(void) { + if (bbep.chip_type != BBEP_CHIP_SSD16xx) return; + if (!bbep.is_awake) return; + bbepCMD2(&bbep, 0x3F, 0x22); // EOPT: TFT discharge frames + sequenced VCOM/HV + bbepCMD2(&bbep, SSD1608_DISP_CTRL2, 0x83); + bbepWriteCmd(&bbep, SSD1608_MASTER_ACTIVATE); + odWatchdogFeed(); + bbepWaitBusy(&bbep); +} + // Lock-held core (callers must hold pwrmgmLock). Split out so Release/Tick can // power off without re-taking the non-recursive lock. static void epdSessionForceOffLocked(void) { @@ -355,8 +373,9 @@ static void epdSessionForceOffLocked(void) { #endif } else { odWatchdogFeed(); // reload before entering bb_epaper (may block ~240 s) + epdSsd16xxPowerOffDischarge(); bbepSleep(&bbep, 1); - delay(50); + delay(EPD_POST_SLEEP_BLEED_MS); } pwrmgm(false); // -> PWR_OFF, clears deadline epdPlanesPrepared = false;