printer
All checks were successful
Deploy WebSocket Server / deploy (push) Successful in 20s

This commit is contained in:
jeremygan2021
2026-03-05 20:17:24 +08:00
parent 3a23a1b47b
commit d1c2ea91ad
3 changed files with 14 additions and 4 deletions

View File

@@ -141,7 +141,11 @@ def process_message(msg, display, image_state, image_data_list, printer_uart=Non
elif image_state == PRINTER_STATE_RECEIVING:
if printer_uart:
printer_uart.write(msg)
chunk_size = 128
for i in range(0, len(msg), chunk_size):
chunk = msg[i:i+chunk_size]
printer_uart.write(chunk)
time.sleep_ms(5)
return image_state, None
return image_state, None
@@ -165,6 +169,9 @@ def process_message(msg, display, image_state, image_data_list, printer_uart=Non
elif msg == "PRINTER_DATA_END":
print("Printer data received completely")
# 发送打印完成的回车
if printer_uart:
printer_uart.write(b'\r\n')
return IMAGE_STATE_IDLE, ("printer_done",)
elif msg.startswith("STATUS:"):