2026 remote: display turned 180 degrees (it sits upside down in the remote)

make_remote_hmi.py now builds the project with Editor display direction 270
(landscape, flipped) before adding pictures and fonts, so they're stored for
that direction. Checked in Nextion Editor and on the real display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-17 22:48:41 +01:00
1 parent aeccba3be7
commit 6b3b2629cd
3 files changed
+23 -5

No files matched your search

+3 -1
View File
@@ -1,6 +1,8 @@
# Nextion HMI # 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 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 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 Editor edit is lost on the next run). Then open `remote.HMI` in Nextion
Binary file not shown.
+18 -2
View File
@@ -120,13 +120,29 @@ def font_dir(arg):
return os.path.join(os.path.dirname(matplotlib.__file__), "mpl-data", "fonts", "ttf") 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): def build(path, fonts):
b = Builder(path) b = Builder(path)
program = ("//Runs once at power-on, before the first page.\r\n" 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" "bauds=115200 //the remote's NEXTION_BAUD; stored in the display\r\n"
"page 0\r\n") "page 0\r\n")
from nxhmi import project new_project_flipped(path, program)
project.new_project("NX4832T035_011", PAGES[0], program=program).save(path)
nx.t_add_font(path, 24, os.path.join(fonts, "DejaVuSansMono-Bold.ttf"), "iso-8859-1") # font 0 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 nx.t_add_font(path, 16, os.path.join(fonts, "DejaVuSansMono.ttf"), "iso-8859-1") # font 1
with tempfile.TemporaryDirectory() as tmp: with tempfile.TemporaryDirectory() as tmp: