upd
This commit is contained in:
parent
d991a07583
commit
4648650f86
2 changed files with 97 additions and 40 deletions
|
|
@ -22,6 +22,8 @@ app.mount("/out", StaticFiles(directory="out"), name="out")
|
|||
|
||||
TASKS_FILE = Path("data/tasks.json")
|
||||
ENABLE_PHYSICAL_PRINTER = True # Set to False to skip physical printing (only generate preview images)
|
||||
PRINTER_DEVICE = "/dev/serial0" # Serial device path
|
||||
PRINTER_BAUDRATE = 19200 # Try 9600 if printer doesn't respond
|
||||
OUT_DIR = Path("out")
|
||||
OUT_DIR.mkdir(exist_ok=True)
|
||||
CARD_WIDTH_PX = 354 # 58mm * 300dpi / 25.4
|
||||
|
|
@ -238,9 +240,9 @@ def print_task(request: Request, task_id: str):
|
|||
|
||||
# Print to physical printer if enabled
|
||||
if ENABLE_PHYSICAL_PRINTER:
|
||||
print(f"[DEBUG] Attempting to print to /dev/serial0...")
|
||||
print(f"[DEBUG] Attempting to print to {PRINTER_DEVICE} at {PRINTER_BAUDRATE} baud...")
|
||||
try:
|
||||
printer = escpos.printer.Serial(devfile="/dev/serial0", baudrate=19200, timeout=1)
|
||||
printer = escpos.printer.Serial(devfile=PRINTER_DEVICE, baudrate=PRINTER_BAUDRATE, timeout=1)
|
||||
printer.text(f"Task: {task.content}\nVon: {task.user}\nPriorität: {task.priority}\n")
|
||||
printer.cut()
|
||||
print(f"[DEBUG] Print command sent successfully")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue