tft: firmware files from a local firmware/ folder, checked by SHA-256
Nextion's seven firmware files cannot be in the repo, so the repo now ships their SHA-256 hashes (src/nxhmi/firmware.sha256, Editor 1.68.2.3035) and every build checks the files against them. The files live in the git-ignored firmware/ folder; `nxhmi firmware --from <Editor folder>` copies them, `nxhmi firmware` reports ok / missing / wrong hash. build-tft and the MCP tool take --firmware-dir / firmware_dir (also NXHMI_FIRMWARE_DIR) instead of the Editor folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0287cf21e4
commit
85422a1ef4
14 files changed
+259
-44
No files matched your search
+7
-6
@@ -78,13 +78,14 @@ class Tools(unittest.TestCase):
|
||||
self.assertIn("pages: home", r["result"]["content"][0]["text"])
|
||||
|
||||
def test_build_tft(self):
|
||||
from nxhmi import project, tft, tft_build
|
||||
for i, n in enumerate(tft_build.FIRMWARE_FILES): # stand-ins for the Editor's files
|
||||
with open(os.path.join(self.tmp, n), "wb") as f:
|
||||
f.write(bytes([i]) * 50)
|
||||
from nxhmi import project, tft
|
||||
from test_tft_build import fake_firmware # stand-ins for Nextion's files
|
||||
patch = fake_firmware(self.tmp)
|
||||
patch.start()
|
||||
self.addCleanup(patch.stop)
|
||||
p, out = os.path.join(self.tmp, "min.HMI"), os.path.join(self.tmp, "min.tft")
|
||||
project.new_project("NX4832T035_011").save(p)
|
||||
r = self.j("build_tft", path=p, tft_path=out, editor_dir=self.tmp)
|
||||
r = self.j("build_tft", path=p, tft_path=out, firmware_dir=self.tmp)
|
||||
with open(out, "rb") as f:
|
||||
data = f.read()
|
||||
self.assertEqual(r["bytes"], len(data))
|
||||
@@ -92,7 +93,7 @@ class Tools(unittest.TestCase):
|
||||
# the demo uses component types that cannot be compiled yet: a tool error, not a crash
|
||||
r = M.handle({"jsonrpc": "2.0", "id": 1, "method": "tools/call",
|
||||
"params": {"name": "build_tft", "arguments": {"path": self.hmi, "tft_path": out,
|
||||
"editor_dir": self.tmp}}})
|
||||
"firmware_dir": self.tmp}}})
|
||||
self.assertTrue(r["result"]["isError"])
|
||||
|
||||
def test_schema(self):
|
||||
|
||||
Reference in new issue
Block a user