Verified Commit 80fda595 authored by Grégor JOUET's avatar Grégor JOUET 🔧
Browse files

Multi try start print

parent 39267c70
Loading
Loading
Loading
Loading
Loading
+43 −33
Original line number Diff line number Diff line
@@ -479,8 +479,10 @@ class OctoPrinter(PrinterBase):
        self.set_plate_clear_flag(True)
        
        gcode_path = os.path.join(FILE_SAVE_PATH, print_obj.gcode)
        i = 0
        while True:
            try:            
                with open(gcode_path) as fh:   

                    self.log(f"[+] Starting print #{print_obj.id} ({print_obj.title})")
                    self._refresh_ready_state()

@@ -505,6 +507,14 @@ class OctoPrinter(PrinterBase):
                        method="post",
                        data={"command": "select", "print": True}
                    )
                    break
            except:
                traceback.print_exc()
                i+=1
                if i == 3:
                    self.log("[-] Cannot start print")
                    return
                

        self.printer_obj.current_print = print_obj
        self.printer_obj.save()