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
+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
|
||||
|
||||
Reference in new issue
Block a user