fix: use HM42 vendor image upload session

This commit is contained in:
yi-bot committed 2026-08-03 03:12:48 +00:00
1 parent 092b104e3d
commit 2919ebe312
5 files changed
+75 -6

No files matched your search

+22
View File
@@ -40,6 +40,28 @@ def requires_complete_image_planes(firmware_revision: str | None) -> bool:
revision = (firmware_revision or "").strip().upper()
return revision.startswith("HM42_AIO")
def uses_hm42_image_session(firmware_revision: str | None) -> bool:
"""Whether image transfer needs the newer HM42 EPD session framing.
The vendor Android provider ``轻舞/时光`` (``d8.e``) wraps both image
planes with ``8001, 0000, 020000`` and closes with ``0101`` followed by
RXTX ``e2`` for a normal (non-calendar) image. The older Web-BLE path has
no such preamble and ends with the legacy one-byte EPD frame.
"""
revision = (firmware_revision or "").strip().upper()
return revision.startswith("HM42_AIO")
def hm42_image_begin_frames() -> tuple[bytes, ...]:
"""Vendor-app EPD image-session preamble for HM42_AIO firmware."""
return (bytes.fromhex("8001"), bytes.fromhex("0000"), bytes.fromhex("020000"))
def hm42_image_finish_frame() -> bytes:
"""Vendor-app EPD image-session terminator for HM42_AIO firmware."""
return bytes.fromhex("0101")
MODES = {
**{f"image{i}": bytes([0xE1, 0x00, 0x00 + i]) for i in range(4)},
"calendar1": bytes.fromhex("e10103"),