diff --git a/2026-current/remote/NEXTION.md b/2026-current/remote/NEXTION.md index 1b440c6..7a16949 100644 --- a/2026-current/remote/NEXTION.md +++ b/2026-current/remote/NEXTION.md @@ -1,6 +1,8 @@ # Nextion HMI -`remote.HMI` in this folder is the touchscreen project (NX4832T035, 480×320). +`remote.HMI` in this folder is the touchscreen project (NX4832T035, 480×320), +turned 180° (Editor display direction 270) because the display sits upside +down in the remote. It's **generated** by `../scripts/make_remote_hmi.py`: change the layout there and re-run it, rather than editing the `.HMI` in Nextion Editor (an Editor edit is lost on the next run). Then open `remote.HMI` in Nextion diff --git a/2026-current/remote/remote.HMI b/2026-current/remote/remote.HMI index 430a27c..7cb3a83 100644 --- a/2026-current/remote/remote.HMI +++ b/2026-current/remote/remote.HMI @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:695793787c934e6285bd873320fae8258c15decc3c7cf2e96b4e2c2ce5771cbf -size 10419026 +oid sha256:c4d7e853d42f1ff75044ef4e6bc87dbfd8e42d22a2634d5d5188929efae6134c +size 10419031 diff --git a/2026-current/scripts/make_remote_hmi.py b/2026-current/scripts/make_remote_hmi.py index 6ed99b6..509a542 100644 --- a/2026-current/scripts/make_remote_hmi.py +++ b/2026-current/scripts/make_remote_hmi.py @@ -120,13 +120,29 @@ def font_dir(arg): return os.path.join(os.path.dirname(matplotlib.__file__), "mpl-data", "fonts", "ttf") +MODEL = "NX4832T035_011" + + +def new_project_flipped(path, program): + """Like nxhmi's project.new_project, but landscape turned 180 degrees (Editor: Setting > + Display direction 270): the display sits upside down in the remote (owner, 2026-11-17). + Must come first: pictures and fonts added afterwards are stored for this direction.""" + from nxhmi import models, project + from nxhmi.components import new_page + direction = models.direction_byte(MODEL, landscape=True, flipped=True) + w, h = models.page_size(MODEL, direction) + items = [("main.HMI", project.make_main(MODEL, [("pa", "0.pa")], "iso-8859-1", direction)), + ("Program.s", program.encode("latin-1")), + ("0.pa", new_page(PAGES[0], w=w, h=h).pack())] + project.build(items).save(path) + + def build(path, fonts): b = Builder(path) program = ("//Runs once at power-on, before the first page.\r\n" "bauds=115200 //the remote's NEXTION_BAUD; stored in the display\r\n" "page 0\r\n") - from nxhmi import project - project.new_project("NX4832T035_011", PAGES[0], program=program).save(path) + new_project_flipped(path, program) nx.t_add_font(path, 24, os.path.join(fonts, "DejaVuSansMono-Bold.ttf"), "iso-8859-1") # font 0 nx.t_add_font(path, 16, os.path.join(fonts, "DejaVuSansMono.ttf"), "iso-8859-1") # font 1 with tempfile.TemporaryDirectory() as tmp: