This commit is contained in:
Aron Petau 2025-11-20 12:06:08 +01:00
parent b3ebce60f4
commit d991a07583
2 changed files with 13 additions and 3 deletions

1
.gitignore vendored
View file

@ -14,6 +14,7 @@ build/
dist/ dist/
.eggs/ .eggs/
*.egg-info/ *.egg-info/
.python-version
# VSCode # VSCode
.vscode/ .vscode/

View file

@ -238,9 +238,18 @@ def print_task(request: Request, task_id: str):
# Print to physical printer if enabled # Print to physical printer if enabled
if ENABLE_PHYSICAL_PRINTER: if ENABLE_PHYSICAL_PRINTER:
printer = escpos.printer.Serial(devfile="/dev/serial0", baudrate=19200, timeout=1) print(f"[DEBUG] Attempting to print to /dev/serial0...")
printer.text(f"Task: {task.content}\nVon: {task.user}\nPriorität: {task.priority}\n") try:
printer.cut() printer = escpos.printer.Serial(devfile="/dev/serial0", baudrate=19200, 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")
except Exception as print_err:
print(f"[ERROR] Printer failed: {print_err}")
import traceback
traceback.print_exc()
else:
print(f"[DEBUG] Physical printer disabled, skipping print")
task.status = "printed" task.status = "printed"
msg = "success" msg = "success"