diff --git a/CLAUDE.md b/CLAUDE.md index 47fa189..1a63b41 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -38,6 +38,13 @@ After rebuilding the demo, `tests/test_project.py::Demo` must still pass: the ge stay byte-identical to the Editor's re-save in `tests/fixtures/`. If a deliberate change breaks that, re-save the demo with Nextion Editor (open, File > Save As) and replace the fixture. +## Editor version + +All findings and the fixture come from **Nextion Editor 1.68.2.3035** (`nxhmi.TESTED_EDITOR_VERSION`). +When verifying against a different Editor build, say so in the commit and in docs/NOTES.md; if a +new build writes different bytes, document the difference in docs/FORMAT.md per version and bump +`TESTED_EDITOR_VERSION` only after the fixture is re-saved and all tests pass. + ## Rules - **Black-box only.** Formats are worked out by changing projects in Nextion Editor and comparing diff --git a/README.md b/README.md index 3322759..16b59fd 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ writes; no Nextion software was decompiled. | Area | Coverage | |---|---| -| `.HMI` read / write / build from scratch | complete for Basic (T) and Intelligent (P) series projects; output byte-identical to Nextion Editor 1.68 | +| `.HMI` read / write / build from scratch | complete for Basic (T) and Intelligent (P) series projects; output byte-identical to Nextion Editor 1.68.2 | | Checksums | all three (page, project header, file table) | | Components | all 31 types, with the Editor's own defaults | | Readable JSON | enum names and `#rrggbb` colours, still byte-exact on the way back | @@ -31,6 +31,19 @@ writes; no Nextion software was decompiled. Details and the full list of gaps: [docs/COVERAGE.md](docs/COVERAGE.md). +## Compatibility + +Everything here was reverse-engineered and verified against **Nextion Editor 1.68.2 (build +1.68.2.3035)** on Windows; `nxhmi.TESTED_EDITOR_VERSION` holds that version. Files written by nxhmi +open in that Editor, and the test fixture is a project re-saved by it. + +- Older projects (tested with one saved by an older Editor in 2019) read and round-trip fine; when + 1.68.2 re-saves them it upgrades a few header bytes (see docs/FORMAT.md). +- **After a Nextion Editor update**: open `demo/demo.HMI` in the new Editor, File > Save As, and + compare it with `tests/fixtures/demo_editor_saved.HMI` (e.g. `python -m nxhmi info` on both, or + replace the fixture and run the tests). If anything differs, the format changed -- please open + an issue with the Editor version. + ## Install Python 3.9+. Pillow is only needed for pictures, font generation and rendering. diff --git a/docs/COVERAGE.md b/docs/COVERAGE.md index 550a954..f2e4a74 100644 --- a/docs/COVERAGE.md +++ b/docs/COVERAGE.md @@ -1,6 +1,6 @@ # Coverage report (updated 2026-11-15) -What nextion-hmi-tools covers today compared with Nextion Editor 1.68, and what is missing. +What openhmi-nx covers today compared with **Nextion Editor 1.68.2 (build 1.68.2.3035)**, and what is missing. "Verified" means checked against the real Editor: either the Editor's own output is reproduced byte for byte, or a file written by nxhmi was opened in the Editor and showed the expected result. diff --git a/docs/FORMAT.md b/docs/FORMAT.md index f9ab99e..0b4a241 100644 --- a/docs/FORMAT.md +++ b/docs/FORMAT.md @@ -1,6 +1,6 @@ # The Nextion Editor `.HMI` project format -Reverse-engineered black-box: by editing projects in Nextion Editor (v1.68), saving, and comparing +Verified against **Nextion Editor 1.68.2 (build 1.68.2.3035)**. Reverse-engineered black-box: by editing projects in Nextion Editor, saving, and comparing files, and by asking the Editor whether hand-made files load ("oracle" tests). The Editor itself was never decompiled or decrypted. Everything here was checked against real files; open points are marked **OPEN**. diff --git a/src/nxhmi/__init__.py b/src/nxhmi/__init__.py index d5bedc9..4013bfc 100644 --- a/src/nxhmi/__init__.py +++ b/src/nxhmi/__init__.py @@ -4,4 +4,7 @@ from .container import HMIFile, build from .page import Page, Component, Attr, Group __version__ = "0.1.0" + +# Nextion Editor build every format rule and test fixture was verified against. +TESTED_EDITOR_VERSION = "1.68.2.3035" __all__ = ["page_crc", "main_crc", "table_crc", "HMIFile", "build", "Page", "Component", "Attr", "Group"] diff --git a/tests/test_checksum.py b/tests/test_checksum.py index 5034b69..8066572 100644 --- a/tests/test_checksum.py +++ b/tests/test_checksum.py @@ -33,6 +33,15 @@ class ChecksumAlgorithms(unittest.TestCase): self.assertEqual(checksum.page_crc(bytes(page)), bitwise_word_crc(bytes(page[4:]) + tail)) +class EditorVersion(unittest.TestCase): + def test_fixture_written_by_tested_editor(self): + """Canary: the fixture's main.HMI carries the marker Editor 1.68.2 writes (offset 9 = 0x44). + If a re-saved fixture from another Editor build changes it, update docs + TESTED_EDITOR_VERSION.""" + import nxhmi + self.assertEqual(nxhmi.TESTED_EDITOR_VERSION, "1.68.2.3035") + self.assertEqual(HMIFile.load(FIXTURE).read("main.HMI")[9], 0x44) + + class ChecksumsOfEditorOutput(unittest.TestCase): """Every checksum in a file written by Nextion Editor 1.68 must verify."""