fix: backlight on CrowPanel Advance 4.3/5.0/7.0 V1.2+ hardware (STC8H1K28 MCU)#307
Open
ElBartoCompany wants to merge 2 commits intomeshtastic:masterfrom
Open
Conversation
The V1.2 hardware revision of the CrowPanel Advance 7-inch (and the 4.3/5.0 siblings sharing this LGFX driver) replaced the TCA9534 I/O expander with an STC8H1K28 microcontroller at I2C 0x30 that now gates the backlight, buzzer, speaker and touch enable. The existing driver only programmed the TCA9534 at 0x18, so boards from V1.2 onward (incl. the V1.3 'latest' revision and V1.4 units currently in the wild) boot with the backlight off — the panel initialises correctly but is only visible under a flashlight. See meshtastic/firmware#7126. Probe I2C 0x30 at init_impl() time and, when the MCU is present, follow Elecrow's reference sequence (pulse GPIO1 low, write 250 to activate touch, write 0 for max backlight) instead of the TCA9534 path. Sleep/wakeup on V1.2+ hardware now toggle backlight via the same MCU (write 245 to disable, write 0 to re-enable). V1.0/V1.1 boards with the TCA9534 at 0x18 continue to use the original code path unchanged. Co-Authored-By: mirko sacchi <sacchimirko44@gmail.com>
Probing I2C 0x30 directly is unreliable on cold boot — the MCU hasn't finished coming up yet and NACKs every probe attempt, which caused the driver to fall through to the TCA9534 path and leave the backlight disabled on V1.4 hardware after a power cycle (though it worked after a soft reset because the MCU retained state from the previous run). Discriminate hardware revisions via the TCA9534 at 0x18 instead — it's always passive and always ACKs on V1.0/V1.1. If the TCA9534 is absent we assume V1.2+ and execute Elecrow's reference wake sequence unconditionally (write 250, pulse GPIO1 low for 120 ms, write 0 for max brightness), repeated 5 times so a single NACK during MCU boot doesn't leave us dark. Co-Authored-By: mirko sacchi <sacchimirko44@gmail.com>
|
|
Collaborator
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LGFX_ELECROW70only knew how to drive the TCA9534 I/O expander at I²C0x18, which is present on CrowPanel Advance 4.3"/5.0"/7.0" V1.0/V1.1 boards. Starting with hardware revision V1.2 (and including V1.3 / V1.4 currently shipping in the wild) Elecrow replaced the TCA9534 with an STC8H1K28 microcontroller at I²C0x30that now gates the backlight, buzzer, speaker and touch-controller enable. With the old driver, V1.2+ boards would initialise the RGB panel correctly but the backlight would never be turned on — the screen was only visible under a flashlight (matches the report in meshtastic/firmware#7126 for the 7" board).Protocol (from Elecrow's CrowPanel-Advance-7-HMI-ESP32-S3 reference repo):
0→ backlight max (V1.3+ scale, also valid on V1.2 as a no-op which leaves the panel dark)245→ backlight off246/247→ buzzer on/off248/249→ speaker on/off250→ activate touch controllerThe MCU needs a wake sequence on cold boot (pulse
GPIO1low for ~120 ms, write250, write0) — a plain I²C probe doesn't work because the STC8H1K28 is still coming up and NACKs every early transmission.What this PR does
0x18atinit_impl()time to classify the hardware revision.write 250 → pulse GPIO1 LOW 120 ms → write 0), repeated 5 times to cover the window during which the MCU is still booting.245= off,0= max) on V1.2+ boards; keep TCA9534 sleep/wakeup for V1.0/V1.1.writeMcu()helper and named constants for the single-byte commands.Validated on real CrowPanel Advance 7.0" V1.4 hardware running
elecrow-adv1-43-50-70-tft: backlight now comes up at full brightness on cold boot, and the device stays stable afterwards.Review & Testing Checklist for Human
Risk: yellow — small, targeted change confined to
LGFX_ELECROW70.h, but it changes the init order slightly and I've only been able to verify on V1.4 hardware.0x30) that backlight comes up on cold boot and stays on during normal use.Wireearly during boot (the I2C scan runs beforescreen->setup()soWireis already begun on SDA=15/SCL=16 by the timeinit_implruns on this variant).Suggested test plan: flash
elecrow-adv1-43-50-70-tfton both an older TCA9534-based unit and a newer STC8H1K28-based unit, cold boot each, and confirm visible backlight + normal LVGL UI on both.Notes
adv2-*envs are not affected by this change.meshtastic/firmwarewill bump thedevice-uipin so the fix reaches users without requiring a local rebuild.250(activate touch) command is issued unconditionally on V1.2+; on boards where touch was already awake this is a no-op, and without it the GT911 touch controller remains unpowered on cold boot.