mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-01 10:21:59 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
e6ae1d63b8
commit
e03fa7c084
@@ -224,6 +224,13 @@ void setup() {
|
|||||||
DisplayDriver* disp = NULL;
|
DisplayDriver* disp = NULL;
|
||||||
if (display.begin()) {
|
if (display.begin()) {
|
||||||
disp = &display;
|
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();
|
disp->startFrame();
|
||||||
#ifdef ST7789
|
#ifdef ST7789
|
||||||
disp->setTextSize(2);
|
disp->setTextSize(2);
|
||||||
@@ -234,6 +241,7 @@ void setup() {
|
|||||||
for (int i = -1; i <= 1; i++)
|
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->fillRect(disp->width() / 2 + i * 3 * dot - dot / 2, disp->height() / 2 - dot / 2, dot, dot);
|
||||||
disp->endFrame();
|
disp->endFrame();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,15 @@ bool WioTrackerL2Board::initExpander() {
|
|||||||
return false; // expander not responding
|
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_WAKE_BTN);
|
||||||
expSetInput(EXP_PIN_I2C_IRQ);
|
expSetInput(EXP_PIN_I2C_IRQ);
|
||||||
expSetInput(EXP_PIN_SD_DETECT);
|
expSetInput(EXP_PIN_SD_DETECT);
|
||||||
|
|||||||
@@ -113,8 +113,11 @@ class LGFX_WioTrackerL2 : public lgfx::LGFX_Device {
|
|||||||
public:
|
public:
|
||||||
Panel_WioTrackerL2& panelL2() { return _panel_instance; }
|
Panel_WioTrackerL2& panelL2() { return _panel_instance; }
|
||||||
bool init_impl(bool use_reset, bool use_clear) override {
|
bool init_impl(bool use_reset, bool use_clear) override {
|
||||||
// bring up backlight controller while the I2C bus is still clean
|
// Bring up the backlight controller while the I2C bus is still clean -- but
|
||||||
_light_instance.init(_light_instance.getBrightness());
|
// 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);
|
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:
|
public:
|
||||||
WioTrackerL2Display() : LGFXDisplay(320, 240, disp) {}
|
WioTrackerL2Display() : LGFXDisplay(320, 240, disp) {}
|
||||||
|
|
||||||
@@ -231,6 +236,14 @@ public:
|
|||||||
}
|
}
|
||||||
void fadeIn() { fade(0, display->getBrightness()); }
|
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)
|
// direct access to the LGFX device (LVGL flush/touch glue)
|
||||||
lgfx::LGFX_Device* lgfxDevice() { return &disp; }
|
lgfx::LGFX_Device* lgfxDevice() { return &disp; }
|
||||||
Panel_WioTrackerL2& panel() { return disp.panelL2(); }
|
Panel_WioTrackerL2& panel() { return disp.panelL2(); }
|
||||||
@@ -260,8 +273,7 @@ public:
|
|||||||
// pixels keep whatever the panel powered up with (they showed as coloured
|
// 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.
|
// lines down the right side and along the bottom). Clear the panel once.
|
||||||
display->fillScreen(TFT_BLACK);
|
display->fillScreen(TFT_BLACK);
|
||||||
display->setBrightness(153);
|
display->setTextColor(TFT_WHITE); // the light comes on with the first frame (endFrame())
|
||||||
display->setTextColor(TFT_WHITE);
|
|
||||||
|
|
||||||
buffer.setColorDepth(8);
|
buffer.setColorDepth(8);
|
||||||
buffer.setPsram(true);
|
buffer.setPsram(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user