All five display series; exact component colours; Editor's literal rule for format 4

- 15 more models (Discovery, Enhanced, Edge, NX8048P043): ids and series bytes 1/6/100 from the
  Editor; native orientation per series; Discovery/Enhanced/Edge use the Basic templates
- per series picture format and storage direction: Enhanced like Basic, Edge format 4,
  Discovery format 3 (20 zero bytes + raw RGB565) always stored row by row; fonts likewise
- component colours are scaled (v*255//31) on every series -- exact against the canvas with zero
  tolerance; format-0 pictures stay bit-replicated
- format-4 encoder: literal pixels when the next 8 runs cover <= 10 pixels (7+ runs), 8 pixels at
  a time -- reproduces the Editor on 12 designed patterns plus the 28 earlier samples

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-16 14:35:50 +01:00
1 parent 922ca21f0f
commit ec35ceb615
9 files changed
+145 -62

No files matched your search

+35 -4
View File
@@ -1,7 +1,8 @@
"""Display models: id stored in main.HMI (offset 16), series byte (offset 11), native resolution.
Only series whose series byte was confirmed in the Editor are listed (Basic = 0, Intelligent = 3).
Model ids are the 32-bit values the Editor writes for each model.
Every model in Nextion Editor 1.68's model dialog, with the series byte and model id the Editor
writes (Basic = 0, Enhanced = 1, Intelligent = 3, Edge = 6, Discovery = 100).
Sizes are listed landscape (width >= height).
"""
from __future__ import annotations
@@ -19,14 +20,32 @@ MODELS = {
"NX8048P070_011": (0xDA27BAA7, 3, 800, 480),
"NX1060P070_011": (0xC43473C2, 3, 1024, 600),
"NX1060P101_011": (0x4FC44FA0, 3, 1024, 600),
"NX8048P043_011": (0xA859A323, 3, 800, 480),
# Discovery (F)
"NX3224F024_011": (0x5B49C1BC, 100, 320, 240),
"NX3224F028_011": (0xBA9C8E20, 100, 320, 240),
"NX4832F035_011": (0x1CE47603, 100, 480, 320),
# Enhanced (K)
"NX3224K024_011": (0x5C7E9301, 1, 320, 240),
"NX3224K028_011": (0xBDABDC9D, 1, 320, 240),
"NX4024K032_011": (0xC4A1A90F, 1, 400, 240),
"NX4832K035_011": (0x1BD324BE, 1, 480, 320),
"NX4827K043_011": (0x63C18A17, 1, 480, 272),
"NX8048K050_011": (0x2E45DE45, 1, 800, 480),
"NX8048K070_011": (0xA1F7596A, 1, 800, 480),
# Edge (E)
"NX4848E021_011": (0xA2770AFE, 6, 480, 480),
"NX4848E028_011": (0x0B3DB14B, 6, 480, 480),
"NX4848E040_011": (0x21B2AF65, 6, 480, 480),
"NX4880E043_011": (0xB7A00D7C, 6, 800, 480),
}
BY_ID = {v[0]: k for k, v in MODELS.items()}
SERIES = {0: "Basic", 3: "Intelligent"}
SERIES = {0: "Basic", 1: "Enhanced", 3: "Intelligent", 6: "Edge", 100: "Discovery"}
# main.HMI offset 12: display direction, in 90-degree steps as chosen in the Editor
# (Setting > Display: 0 / 90 / 180 / 270). Basic panels are portrait at 0 degrees, so the
# landscape sizes listed above need 90 or 270; Intelligent panels are landscape at 0 and 180.
NATIVE_PORTRAIT = {0: True, 3: False}
NATIVE_PORTRAIT = {0: True, 1: True, 3: False, 6: True, 100: True} # as listed in the model dialog
def direction_byte(model: str, landscape: bool = True, flipped: bool = False) -> int:
@@ -35,6 +54,18 @@ def direction_byte(model: str, landscape: bool = True, flipped: bool = False) ->
return (1 if landscape == portrait_native else 0) + (2 if flipped else 0)
def storage_direction(series: int, direction: int) -> int:
"""Direction pictures and fonts are stored in (their byte 0 / 3 = 0x0A + this): the project
direction, except Discovery, which always stores row by row (0) -- measured in Editor 1.68."""
return 0 if series == 100 else direction % 4
def picture_format(series: int) -> int:
"""N.i format the Editor writes: 0 raw (Basic, Enhanced), 4 run-length/JPEG (Intelligent, Edge),
3 raw with a 20-byte zero header (Discovery)."""
return {3: 4, 6: 4, 100: 3}.get(series, 0)
def page_size(model: str, direction: int):
"""(width, height) of the pages for main.HMI byte 12 = direction."""
_, series, w, h = lookup(model)