feat(ppclock): 倒计时前缀文字位图(clock 拆包/calendar 990 序列)+ CLI --prefix/--show-calendar,102 测试全绿

This commit is contained in:
agent committed 2026-07-24 11:01:44 +00:00
1 parent 2b01e5f589
commit f291c61676
7 files changed
+367 -3

No files matched your search

+16 -1
View File
@@ -51,7 +51,22 @@ async def upload_image(t, bw: bytes, red: bytes | None, *, small: bool,
await t.write_epd(P.end_frame(small=small))
async def countdown_set(t, d: datetime.date, mode: str):
async def countdown_set(t, d: datetime.date, mode: str, prefix: str | None = None,
show_calendar: bool = False):
"""倒计时:前缀文字位图(可选)→ 日期帧 → E2。
show_calendar=True 走 upload_rili 序列:990* → FA → e10103 → E2(timedjs2.js:308-312)。"""
from . import textbitmap as TB
if prefix:
for frame in TB.prefix_frames(prefix, "calendar" if show_calendar else mode):
await t.write_rxtx(frame)
await t.delay(1.0)
if show_calendar:
await t.write_rxtx(bytes([0xFA]))
await t.delay(1.0)
await t.write_rxtx(P.mode_frame("calendar1"))
await t.delay(1.0)
await t.write_rxtx(P.simple_command("commit"))
return
await t.write_rxtx(P.countdown_date_frame(d, mode))
await t.delay(1.0)
await t.write_rxtx(P.simple_command("commit"))