From e03fa7c0848ca6ca9741e6f9de572640c5d70a7a Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Sun, 25 Oct 2026 21:33:59 +0100 Subject: [PATCH] fix(l2): no bright bar on the dark screen at power-on The first frame (the sprite's default white background, black dots) came out as a bright bar across the middle of the screen. A plain black frame now, and the backlight stays off until it's sent: dark through the panel's reset and init (the LP5814 keeps its state across a restart), lit with the first frame. Co-Authored-By: Claude Sonnet 5.5 --- examples/companion_radio/main.cpp | 8 ++++++++ variants/wio-tracker-l2/WioTrackerL2Board.cpp | 9 +++++++++ variants/wio-tracker-l2/WioTrackerL2Display.h | 20 +++++++++++++++---- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 265e426b..8da39431 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -224,6 +224,13 @@ void setup() { DisplayDriver* disp = NULL; if (display.begin()) { disp = &display; + #if defined(SEEED_WIO_TRACKER_L2) + // L2: a plain black frame -- the panel's backlight comes on with it (WioTrackerL2Display + // ::endFrame()). The default colours here (white background, black dots) came out as a + // bright bar across the middle of the dark screen. LVGL's splash follows within a second. + disp->startFrame(0x0000); + disp->endFrame(); + #else disp->startFrame(); #ifdef ST7789 disp->setTextSize(2); @@ -234,6 +241,7 @@ void setup() { for (int i = -1; i <= 1; i++) disp->fillRect(disp->width() / 2 + i * 3 * dot - dot / 2, disp->height() / 2 - dot / 2, dot, dot); disp->endFrame(); + #endif } #endif diff --git a/variants/wio-tracker-l2/WioTrackerL2Board.cpp b/variants/wio-tracker-l2/WioTrackerL2Board.cpp index af3a6417..8453641d 100644 --- a/variants/wio-tracker-l2/WioTrackerL2Board.cpp +++ b/variants/wio-tracker-l2/WioTrackerL2Board.cpp @@ -59,6 +59,15 @@ bool WioTrackerL2Board::initExpander() { return false; // expander not responding } + // The backlight (the LP5814 at 0x2C) dark before the panel is powered and + // reset below: until it's initialised the panel shows what's in its memory (a + // white bar over the ~0.5 s settle), and the LP5814 keeps its state across a + // restart. Standby: CHIP_EN off; the display driver brings it up again. + Wire.beginTransmission(0x2C); + Wire.write((uint8_t)0x00); + Wire.write((uint8_t)0x00); + Wire.endTransmission(); + expSetInput(EXP_PIN_WAKE_BTN); expSetInput(EXP_PIN_I2C_IRQ); expSetInput(EXP_PIN_SD_DETECT); diff --git a/variants/wio-tracker-l2/WioTrackerL2Display.h b/variants/wio-tracker-l2/WioTrackerL2Display.h index e11fbd3f..326fbdd9 100644 --- a/variants/wio-tracker-l2/WioTrackerL2Display.h +++ b/variants/wio-tracker-l2/WioTrackerL2Display.h @@ -113,8 +113,11 @@ class LGFX_WioTrackerL2 : public lgfx::LGFX_Device { public: Panel_WioTrackerL2& panelL2() { return _panel_instance; } bool init_impl(bool use_reset, bool use_clear) override { - // bring up backlight controller while the I2C bus is still clean - _light_instance.init(_light_instance.getBrightness()); + // Bring up the backlight controller while the I2C bus is still clean -- but + // dark: the panel's memory holds noise until it's initialised and cleared + // (a white bar across the screen), and a chip left lit by a restart would + // show it too. begin() switches the light on after the clear. + _light_instance.init(0); bool result = LGFX_Device::init_impl(use_reset, use_clear); @@ -202,6 +205,8 @@ class WioTrackerL2Display : public LGFXDisplay { } } + bool _lit = false; // the light has come on with the first frame + public: WioTrackerL2Display() : LGFXDisplay(320, 240, disp) {} @@ -231,6 +236,14 @@ public: } void fadeIn() { fade(0, display->getBrightness()); } + // The first frame goes out with the light still off, then the light comes on: + // lit any sooner, the panel shows what it holds in memory for as long as the + // frame takes. + void endFrame() override { + LGFXDisplay::endFrame(); + if (!_lit) { _lit = true; display->setBrightness(153); } + } + // direct access to the LGFX device (LVGL flush/touch glue) lgfx::LGFX_Device* lgfxDevice() { return &disp; } Panel_WioTrackerL2& panel() { return disp.panelL2(); } @@ -260,8 +273,7 @@ public: // pixels keep whatever the panel powered up with (they showed as coloured // lines down the right side and along the bottom). Clear the panel once. display->fillScreen(TFT_BLACK); - display->setBrightness(153); - display->setTextColor(TFT_WHITE); + display->setTextColor(TFT_WHITE); // the light comes on with the first frame (endFrame()) buffer.setColorDepth(8); buffer.setPsram(true);