Sleep: drive and hold the 20 RGB panel lines low before deep sleep (white flickering edges seen on the bench)
Firmware / build (push) Successful in 7m7s
Firmware / build (push) Successful in 7m7s
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <lvgl.h>
|
||||
#include <esp_sleep.h>
|
||||
#include <driver/rtc_io.h>
|
||||
#include <driver/gpio.h>
|
||||
|
||||
namespace PowerManager {
|
||||
|
||||
@@ -78,12 +79,32 @@ static const char* blocker() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// The RGB panel's 20 signal lines (Waveshare 5B board header). In deep sleep the
|
||||
// LCD peripheral stops and these pins would float: a panel with no clock and
|
||||
// floating data shows white/flickering edges if any light reaches it. Drive
|
||||
// them low and HOLD them through the sleep, so the panel sees a black frame.
|
||||
static const int RGB_PINS[] = {46, 3, 5, 7, 14, 38, 18, 17, 10, 39, 0, 45, 48, 47, 21, 1, 2, 42, 41, 40};
|
||||
|
||||
static void parkPanel() {
|
||||
lvgl_port_lock(-1); // stop the render task from touching the panel while we take the pins
|
||||
for (int pin : RGB_PINS) {
|
||||
gpio_reset_pin((gpio_num_t)pin);
|
||||
gpio_set_direction((gpio_num_t)pin, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level((gpio_num_t)pin, 0);
|
||||
gpio_hold_en((gpio_num_t)pin);
|
||||
}
|
||||
gpio_deep_sleep_hold_en();
|
||||
// the lock is deliberately not released: nothing must draw again before sleep
|
||||
}
|
||||
|
||||
static void goToSleep(const char* reason) {
|
||||
print("[sleep] %s - deep sleep now; the CAN bus wakes me", reason);
|
||||
Tunables::flush();
|
||||
DisplayInit::setBacklight(false);
|
||||
DisplayInit::setBacklight(false); // CH422G EXIO2 low; the expander keeps it while we sleep
|
||||
delay(50);
|
||||
CANDriver::stop(); // frees GPIO 16 from the TWAI peripheral
|
||||
delay(400); // let the CAN task deinit TWAI
|
||||
parkPanel();
|
||||
// CAN RX idles high (recessive); the first bit of any frame pulls it low.
|
||||
rtc_gpio_pulldown_dis((gpio_num_t)CAN_RX_PIN);
|
||||
rtc_gpio_pullup_en((gpio_num_t)CAN_RX_PIN);
|
||||
|
||||
@@ -20,6 +20,10 @@ Deep sleep when the bit is set, no DATA frame on any transport for 60 s, no upda
|
||||
|
||||
See the log entry of the day: switch → CONFIG → Inst. Cluster within a CONFIG period; `sleep now` on the Inst. Cluster and its wake.
|
||||
|
||||
## Bench finding 2026-09-28: flickering white edges while asleep
|
||||
|
||||
First deep sleep on the bench: the panel showed a flickering white glow around the edges. In deep sleep the LCD peripheral stops and the 20 RGB lines float; a panel with no pixel clock and floating data lights up if any backlight current flows. Fix in `goToSleep()`: after the backlight is switched off through the CH422G (EXIO2), every RGB line (HSYNC 46, VSYNC 3, DE 5, PCLK 7, D0-15 = 14 38 18 17 10 39 0 45 48 47 21 1 2 42 41 40) is driven low and held (`gpio_hold_en` + `gpio_deep_sleep_hold_en`) with the LVGL lock taken so nothing draws again. Whether the glow is gone is the user's observation to make - if it persists, the backlight enable is not really off in sleep and the expander pin needs a look (or the LED driver has its own enable).
|
||||
|
||||
## Not verified
|
||||
|
||||
- The Main CTRL's own sleep and CAN wake need the car (a quiet bus that later talks). Bench boards have no bus, so they would never wake.
|
||||
|
||||
Reference in New Issue
Block a user