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:
1 parent
aeccba3be7
commit
6b3b2629cd
3 files changed
+23
-5
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user