Add headless C3 build with virtual display over HTTP#1
Open
theNailz wants to merge 3 commits intofeature/lovyan-gfxfrom
Open
Add headless C3 build with virtual display over HTTP#1theNailz wants to merge 3 commits intofeature/lovyan-gfxfrom
theNailz wants to merge 3 commits intofeature/lovyan-gfxfrom
Conversation
New [env:esp32c3-headless] skips physical display init (tft.init, backlight) and instead allocates a 240x280 LGFX_Sprite as a RAM framebuffer. The full rendering pipeline runs unchanged against the sprite. Adds GET /screenshot (serves sprite as BMP) and GET /display (HTML page with 2s auto-refresh) so display output can be observed in any browser without a physical screen attached. Useful for debugging display logic on a bare C3 module.
- Change tft type from LGFX_Device to LovyanGFX (common base) so it can point to either hardware display or LGFX_Sprite in headless mode - In HEADLESS mode, tft now targets the sprite framebuffer so all draw calls are captured for the /screenshot endpoint - Stream BMP row-by-row instead of malloc'ing the full 197KB image, fixing OOM crash on ESP32-C3 (no PSRAM) - Update all helper functions (gauges, anims, icons) to accept LovyanGFX& instead of LGFX_Device&
- Sprite now uses LY_W×LY_H (240×240) instead of hardcoded 240×280, saving 19KB of SRAM on the C3 - This frees enough heap for the ~59KB settings page to load at / - Use LY_W/LY_H in screenshot rowBuf and /display HTML dimensions - Add layout.h include to web_server.cpp
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
Adds an
esp32c3-headlessbuild environment for debugging display rendering on an ESP32-C3 without a physical screen. All drawing goes into an in-RAM LGFX_Sprite framebuffer, served as a live BMP image via HTTP.[env:esp32c3-headless]in platformio.ini with-D HEADLESS=1tftpoints to an LGFX_Sprite instead of hardware — all draw calls capturedGET /screenshotstreams a 240×280 BMP row-by-row (no large malloc, works on C3's limited SRAM)GET /displayserves a minimal HTML page with 2s auto-refresh — live virtual monitor in browserLGFX_Device&toLovyanGFX&(common base) so they accept both hardware and sprite targetsinit(),invertDisplay()) use concrete_tft_instancedirectly/displayconfirmed working in browserWhat this is NOT
Test plan
/screenshotreturns valid 201KB BMP (200 OK)/displayshows live virtual monitor in browser