This commit is contained in:
9
main.py
9
main.py
@@ -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:"):
|
||||
|
||||
Reference in New Issue
Block a user