fix: use HM42 vendor image upload session
This commit is contained in:
1 parent
092b104e3d
commit
2919ebe312
5 files changed
+75
-6
No files matched your search
@@ -101,10 +101,17 @@ class TestCommands:
|
||||
)
|
||||
assert result["bytes_bw"] == 15000
|
||||
assert result["bytes_red"] == 15000
|
||||
assert len(client._t.epd_writes) == 63 + 63 + 1
|
||||
first_red = client._t.epd_writes[63]
|
||||
assert client._t.epd_writes[:3] == [
|
||||
bytes.fromhex("8001"),
|
||||
bytes.fromhex("0000"),
|
||||
bytes.fromhex("020000"),
|
||||
]
|
||||
assert len(client._t.epd_writes) == 3 + 63 + 63 + 1
|
||||
first_red = client._t.epd_writes[3 + 63]
|
||||
assert first_red[:4] == bytes.fromhex("03000000")
|
||||
assert set(first_red[4:]) == {0}
|
||||
assert client._t.epd_writes[-1] == bytes.fromhex("0101")
|
||||
assert client._t.rxtx_writes[-1] == bytes.fromhex("e2")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_render_template(self, client):
|
||||
|
||||
+19
-1
@@ -7,10 +7,11 @@ from ppclock import commands as C
|
||||
|
||||
|
||||
class FakeTransport:
|
||||
def __init__(self, id_response="DEVICE12345678"):
|
||||
def __init__(self, id_response="DEVICE12345678", firmware_revision=None):
|
||||
self.epd_writes = []
|
||||
self.rxtx_writes = []
|
||||
self.id_response = id_response
|
||||
self.firmware_revision = firmware_revision
|
||||
self.delays = []
|
||||
|
||||
async def write_epd(self, data, response=True):
|
||||
@@ -80,6 +81,23 @@ class TestUploadImage:
|
||||
assert t.epd_writes[-1] == bytes([0xAA])
|
||||
assert t.epd_writes[0][0] == 0x04
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_hm42_uses_vendor_epd_session(self):
|
||||
t = FakeTransport(firmware_revision="HM42_AIO_V1.0.9")
|
||||
await C.upload_image(
|
||||
t, bytes(15000), bytes(15000), small=False, slot=1
|
||||
)
|
||||
assert t.rxtx_writes == [bytes.fromhex("EA01"), bytes.fromhex("E2")]
|
||||
assert t.epd_writes[:3] == [
|
||||
bytes.fromhex("8001"),
|
||||
bytes.fromhex("0000"),
|
||||
bytes.fromhex("020000"),
|
||||
]
|
||||
assert t.epd_writes[3][:4] == bytes.fromhex("03FF0000")
|
||||
assert t.epd_writes[66][:4] == bytes.fromhex("03000000")
|
||||
assert t.epd_writes[-1] == bytes.fromhex("0101")
|
||||
assert len(t.epd_writes) == 3 + 63 + 63 + 1
|
||||
|
||||
|
||||
class TestOtherCommands:
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -73,6 +73,17 @@ class TestCommandFrames:
|
||||
assert P.requires_complete_image_planes("PP_da14585_4.2") is False
|
||||
assert P.requires_complete_image_planes(None) is False
|
||||
|
||||
def test_hm42_image_session_by_firmware_family(self):
|
||||
assert P.uses_hm42_image_session("HM42_AIO_V1.0.9") is True
|
||||
assert P.uses_hm42_image_session("PP_da14585_4.2") is False
|
||||
assert P.uses_hm42_image_session(None) is False
|
||||
assert P.hm42_image_begin_frames() == (
|
||||
bytes.fromhex("8001"),
|
||||
bytes.fromhex("0000"),
|
||||
bytes.fromhex("020000"),
|
||||
)
|
||||
assert P.hm42_image_finish_frame() == bytes.fromhex("0101")
|
||||
|
||||
def test_parking(self):
|
||||
"""停车牌 "12" → EF1122(向量#4)"""
|
||||
assert P.parking_frame("12") == bytes([0xEF, 0x11, 0x22])
|
||||
|
||||
Reference in new issue
Block a user