Skip to content

Anti-aliased VLW fonts using Inter#44

Closed
theNailz wants to merge 4 commits intoKeralots:mainfrom
theNailz:feature/vlw-fonts
Closed

Anti-aliased VLW fonts using Inter#44
theNailz wants to merge 4 commits intoKeralots:mainfrom
theNailz:feature/vlw-fonts

Conversation

@theNailz
Copy link
Copy Markdown
Contributor

@theNailz theNailz commented Apr 1, 2026

Summary

  • Replace bitmap fonts (1/2/4) with smooth anti-aliased VLW fonts generated from Inter Regular at 10/14/19pt
  • Font 7 (7-segment) kept as-is for clock displays
  • New fonts.h abstraction layer with setFont() helper — centralizes all font selection
  • Python generator script (scripts/generate_vlw_fonts.py) for reproducible font builds from TTF source
  • Character set: printable ASCII + degree symbol (96 glyphs)

Depends on #37 (LovyanGFX migration) — rebase onto main after that merges.

Flash usage (on top of LovyanGFX)

Board Before After
S3 69.1% 71.5%
CYD 66.7% 68.9%
C3 65.3% 70.5%

Test plan

  • All three environments build clean
  • Flashed and verified on S3 — text renders with anti-aliased Inter font
  • Clock mode Font 7 (7-segment) still works correctly
  • Verify CYD
  • Verify C3
  • Fine-tune text positioning if needed (VLW metrics differ slightly from bitmap fonts)

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)
Replace LovyanGFX built-in bitmap fonts (1/2/4) with smooth anti-aliased
VLW fonts generated from Inter Regular at 10/14/19pt. Font 7 (7-segment)
is kept for clock displays.

- Add Python script to generate VLW PROGMEM headers from TTF
- Create font abstraction layer (fonts.h) with setFont() helper
- Migrate all setTextFont() calls across 5 display files
- All three targets build (~70% flash with LovyanGFX)
@theNailz theNailz closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant