Migrate display from TFT_eSPI to LovyanGFX#37
Draft
theNailz wants to merge 3 commits intoKeralots:mainfrom
Draft
Migrate display from TFT_eSPI to LovyanGFX#37theNailz wants to merge 3 commits intoKeralots:mainfrom
theNailz wants to merge 3 commits intoKeralots:mainfrom
Conversation
Contributor
Author
|
The ESP32 is too busy writing flash to respond to /ota/status poll requests, so _autoOtaProgress often stays at a low value (e.g. 25%) even when the download completes successfully. The previous >= 90% threshold guard then blocked waitForReboot(), leaving the UI frozen. Replace the progress threshold with an _otaInstallStarted flag set after the server confirms the OTA task has begun. Any 404/network error after install is confirmed now correctly triggers waitForReboot(), regardless of the last polled progress value.
platformio.ini (esp32c3 env): - Switch to partitions_4mb_c3.csv (1.875 MB OTA partitions) - build_unflags: strip LOAD_GFXFF and SMOOTH_FONT — GFX free fonts and smooth VLW font renderer are compiled in by default but never used - Explicit lib_deps without TFT_eWidget (dead code for C3) partitions_4mb_c3.csv (new): - app0/app1: 0x1E0000 (1.875 MB) each, up from 1.75 MB - SPIFFS: 0x30000 (192 KB), reduced from 448 KB — SPIFFS unused in BambuHelper - Result: 65 KB → 733 KB headroom - Note: partition table change requires USB re-flash; OTA updates thereafter src/main.cpp, src/display_ui.cpp: - USB CDC startup delay and Serial.flush() removal (previously unstaged)
Replace TFT_eSPI with LovyanGFX across the entire display stack. Board-specific configs (S3, CYD, C3) are C++ classes in display_ui.cpp. SPI pins and driver settings move from build_flags into the class configs, simplifying platformio.ini significantly. The C3 no longer needs the SPI patch script. Key changes: - Three LGFX board classes: LGFX_S3 (ST7789), LGFX_CYD (ILI9342), LGFX_C3 (ST7789) - fillArc replaces drawSmoothArc in gauge rendering; +90deg angle offset matches original gap-at-bottom orientation - alphaBlend565() helper replaces tft.alphaBlend() (not a member in LGFX) - drawArc (outline) replaces drawSmoothArc in animation code - S3 requires invertDisplay(true) at runtime for correct colors - Backlight handled via BACKLIGHT_PIN + analogWrite (unchanged) - config.h: BACKLIGHT_PIN guard added (was hardcoded to TFT_BL)
f2f0bd9 to
ab274a7
Compare
Contributor
Author
|
I'm waiting for my C3 and CYD to finalize this; might take a few days |
This was referenced Apr 1, 2026
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
platformio.inibuild flags into typed C++ classes indisplay_ui.cpp, eliminating theUser_Setup.hpattern entirelyplatformio.inisimplified significantly — no more per-env driver/pin definesfillArc(filled rings) with a +90° angle offset to match the original gap-at-bottom orientationalphaBlend565()helper replacestft.alphaBlend()(not a member in LGFX)drawArc(outline) replacesdrawSmoothArcin animation codeinvertDisplay(true)at runtime for correct ST7789 colors#ifdef ENABLE_OTA_AUTOFlash usage (after migration)
Test plan