tft: page section format, pictures/fonts, first builder (nxhmi build-tft)

Byte-identical to Nextion Editor 1.68.2 for NX4832T035 projects made of pages,
hotspots and int variables with any pictures and fonts. Firmware files are read
from the user's Editor folder at build time. FORMAT.md section 7 documents the
header, resource area, code blob, attribute records, page table and objects.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Fable 5.2 committed 2026-11-16 18:13:11 +01:00
1 parent 7337e693a5
commit f66c902443
10 files changed
+589 -5

No files matched your search

+25
View File
@@ -130,3 +130,28 @@ The file length is always a multiple of 4 (the page section is padded with zeros
Other dead ends, for the record: seeds from header fields; header checksum fields zeroed/0xFF in
every combination; the layout table de-obfuscated before checksumming; prefixes built from
length/layout words; runs of 00/FF bytes before the file.
### Page section solved, first builder (2026-11-16)
Format: FORMAT.md section 7. `nxhmi build-tft` reproduces the Editor byte for byte for projects
made of pages (solid colour), hotspots and int variables, with any pictures and fonts, on
NX4832T035. Check with `NXHMI_TFT_SAMPLES=<folder of name.HMI + name.tft> python -m unittest
discover -s tests -p test_tft_build.py` (samples stay outside the repo).
How the samples are made: one tiny project per question (nxhmi builds them), compiled in the
Editor by a click script (open file, Compile, File > TFT file output > Output), ~45 s each.
A project whose script does not compile yields no TFT -- e.g. `sys0` is only known when
`Program.s` declares it (`int sys0=0,sys1=0,sys2=0`, as in the Editor's default program).
Useful facts not obvious from the format description:
- Text-like components need a font in the project or the compile fails.
- Every component type brings its own generated script (draw section, init lines); e.g. a
progress bar's draw section is three `fill`-like lines computed from x/y/w/h and `val`.
These must be collected per type -- the bulk of the remaining work.
- Record references in scripts (`01` + u32) are global record numbers, so adding a component
renumbers every reference after it.
Not done: script tokens beyond `baud=115200` / `page N`; timers, sliders and every drawing
component; global variables declared in Program.s (blob header tables 0 and 1); other models,
portrait, other series; and nothing has been loaded onto a display.