Minor tweaks
This commit is contained in:
parent
393072a9f8
commit
037fa023f7
1 changed files with 6 additions and 5 deletions
|
@ -70,7 +70,7 @@ def poll_printers(app: App, db: Db) -> None:
|
||||||
def _set_status(status: str):
|
def _set_status(status: str):
|
||||||
if printer.status != status:
|
if printer.status != status:
|
||||||
log.info(f"Printer {printer.id} {printer.status} -> {status}")
|
log.info(f"Printer {printer.id} {printer.status} -> {status}")
|
||||||
db.update_printer_status(pid=printer.id, status=status)
|
db.update_printer_status(pid=printer.id, status=status)
|
||||||
|
|
||||||
def _bed_clear():
|
def _bed_clear():
|
||||||
if not (
|
if not (
|
||||||
|
@ -117,7 +117,7 @@ def poll_printers(app: App, db: Db) -> None:
|
||||||
if mapped_job:
|
if mapped_job:
|
||||||
db.start_job(jid=mapped_job.id)
|
db.start_job(jid=mapped_job.id)
|
||||||
|
|
||||||
elif printer_job.get("state").lower() == "connecting":
|
elif printer_job.get("state", "").lower() == "connecting":
|
||||||
_set_status("connecting")
|
_set_status("connecting")
|
||||||
|
|
||||||
elif printer_state.get("ready"):
|
elif printer_state.get("ready"):
|
||||||
|
@ -171,8 +171,8 @@ def assign_jobs(app: App, db: Db) -> None:
|
||||||
db.assign_job(jid=job.id, pid=printer.id)
|
db.assign_job(jid=job.id, pid=printer.id)
|
||||||
log.info(f"Mapped job {job.id} to printer {printer.id}")
|
log.info(f"Mapped job {job.id} to printer {printer.id}")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("Could not map\n", job, "\n", printer)
|
log.info(f"Could not map job {job!r}")
|
||||||
|
|
||||||
|
|
||||||
def push_jobs(app: App, db: Db) -> None:
|
def push_jobs(app: App, db: Db) -> None:
|
||||||
|
@ -307,7 +307,8 @@ def analyze_files(app: App, db: Db):
|
||||||
for file in db.list_unanalyzed_files():
|
for file in db.list_unanalyzed_files():
|
||||||
p = Path(file.path)
|
p = Path(file.path)
|
||||||
if not p.is_file():
|
if not p.is_file():
|
||||||
log.error(f"Invalid file {file.id}!")
|
log.error(f"Deleting missing file {file.id}!")
|
||||||
|
db.delete_file(uid=file.user_id, fid=file.id)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
record = analyze_gcode_file(p)
|
record = analyze_gcode_file(p)
|
||||||
|
|
Loading…
Reference in a new issue