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

Check for printing

parent 72982bc2
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ Fablab 3d printing request application
- [ ] Edit the print request
  - [ ] Manualy set the state
  - [ ] Delete
  - [ ] Asign the request
  - [ ] Assign the request
- [x] Accept/Reject print request (front)
  - [x] See STL file in 3d
  - [x] See print status
@@ -28,13 +28,15 @@ Fablab 3d printing request application
- [x] Slice
  - [x] Upload GCODE
  - [x] Download GCODE
  - [ ] **V2**: Open slicer window
  - [ ] **V3**: Open slicer window
    - [ ] : Slicer management
- [ ] Video feedback
- [ ] Message system
  - [ ] Post message on each request
  - [ ] New message indication
- [x] Queue management
  - [x] Working queues
  - [ ] Indicate successfull / error in printing
  - [x] Indicate successfull / error in printing
  - [x] **v2** Printer management
  - [x] **v2** Post to octoprint

+16 −1
Original line number Diff line number Diff line
@@ -249,6 +249,21 @@ def whoami():
def get_my_requests():
    return jsonify(loop_requests(lookup_requests(current_user.username)))

@app.route("/requests/<req_id>/dequeue")
@jwt_required
def dequeue_request(req_id):
    req: PrintRequest = get_request_by_id(req_id)
    if req is None:
        return jsonify({"error": "No such request"}), status.HTTP_404_NOT_FOUND

    if req.queue_element == None:
        return jsonify({"error": "Not queued"}), status.HTTP_404_NOT_FOUND

    req.queue_element.state = 3
    req.queue_element.save()
    req.queue_element = None
    req.save()
    return jsonify({})

@app.route("/requests/<req_id>", methods=["PUT"])
@jwt_required
@@ -720,7 +735,7 @@ def home_printer(id):
@jwt_required
def home_all():
    for p in get_printers():
        if p.printer_model() == "octoprint" and p.ready_state:
        if p.printer_model() == "octoprint" and p.accept_control:
            p.goto_home()
    return jsonify({})

+2 −1
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ class OctoPrinter(PrinterBase):
            time.sleep(.3)
        self._make_octoprint_raw_request(
            "/api/printer/printhead",
            data={"command": "jog", "z": 5, "absolute": False},
            data={"command": "jog", "z": 15, "absolute": False},
        )
        self._make_octoprint_raw_request(
            "/api/printer/printhead",
@@ -440,6 +440,7 @@ class OctoPrinter(PrinterBase):
        self._refresh_ready_state()
        if not self.ready_state:
            raise Exception("Printer is not ready")
        self.set_plate_clear_flag(True)
        
        gcode_path = os.path.join(FILE_SAVE_PATH, print_obj.gcode)
        with open(gcode_path) as fh:   
Loading