diff --git a/src/octoprint/filemanager/__init__.py b/src/octoprint/filemanager/__init__.py index 10aed238..fadcaf88 100644 --- a/src/octoprint/filemanager/__init__.py +++ b/src/octoprint/filemanager/__init__.py @@ -182,7 +182,7 @@ class FileManager(object): self.add_file(dest_location, dest_path, file_obj, links=links, allow_overwrite=True) end_time = time.time() - eventManager().fire(Events.SLICING_DONE, {"stl": source_path, "gcode": dest_path, "time": end_time - start_time}) + eventManager().fire(Events.SLICING_DONE, {"stl": source_path, "gcode": dest_path, "gcode_location": dest_location, "time": end_time - start_time}) if callback is not None: if callback_args is None: diff --git a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 index b4311d90..ccfe2416 100644 --- a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 +++ b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 @@ -179,9 +179,9 @@ var UI_API_KEY = "{{ uiApiKey }}";
Z-Axis
- + - +
{% endif %} diff --git a/src/octoprint/printer.py b/src/octoprint/printer.py index 1a7a13fc..3253b946 100644 --- a/src/octoprint/printer.py +++ b/src/octoprint/printer.py @@ -201,8 +201,10 @@ class Printer(): self.command("?") def home(self, axes): - #self.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), axes)), "G90"]) - self.commands(["$H", "G92X0Y0Z0", "G90", "G21"]) + if(settings().getBoolean(["feature", "grbl"])): + self.commands(["$H", "G92X0Y0Z0", "G90", "G21"]) + else: + self.commands(["G91", "G28 %s" % " ".join(map(lambda x: "%s0" % x.upper(), axes)), "G90"]) def extrude(self, amount): extrusionSpeed = settings().get(["printerParameters", "movementSpeed", "e"]) diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index c1d50161..ce82432e 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -377,8 +377,6 @@ def gcodeConvertCommand(): import re svg = data['svg'] - #svg = re.sub(r"inkscape:[a-zA-Z_-]+=\".*?\" ", "", svg) - #svg = re.sub(r"sodipodi:[a-zA-Z_-]+=\".*?\" ", "", svg) del data['svg'] @@ -401,9 +399,6 @@ def gcodeConvertCommand(): fileObj = Wrapper(filename, svg) fileManager.add_file(target, filename, fileObj, links=None, allow_overwrite=True) - #fh = open(filename, 'w') - #fh.write(svg) - #fh.close() slicer = "svgtogcode"; if "slicer" in data.keys() and data["slicer"]: diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 32d8eb6e..39479517 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -33,7 +33,8 @@ default_settings = { "connection": 2, "communication": 10, "temperature": 5, - "sdStatus": 1 + "sdStatus": 1, + "position": 0.5 }, "additionalPorts": [] }, diff --git a/src/octoprint/static/css/mrbeam.css b/src/octoprint/static/css/mrbeam.css index 7fadca5a..c7b40e6f 100644 --- a/src/octoprint/static/css/mrbeam.css +++ b/src/octoprint/static/css/mrbeam.css @@ -1623,6 +1623,22 @@ input.search-query, min-height:24px; } +.safety_glasses_heads_up { + background-image:url(../img/safety_glasses_heads_up500.png); + background-repeat: no-repeat; + background-position: center; + background-size: contain; + width:250px; + height:150px; + float: right; + margin: 0em 1em; +} + +.safety_glasses_warning { + font-size: large; + font-weight: bold; +} + #settingsTabs li.saveInProgress a:after { content:"\f021"; font-family: FontAwesome; diff --git a/src/octoprint/static/img/safety_glasses_heads_up500.png b/src/octoprint/static/img/safety_glasses_heads_up500.png new file mode 100644 index 00000000..11977720 Binary files /dev/null and b/src/octoprint/static/img/safety_glasses_heads_up500.png differ diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index 8ecea4c2..bee1c85d 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -117,6 +117,7 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicing self._otherRequestInProgress = false; self.requestData = function(filenameToFocus, locationToFocus) { + console.log("requestData", filenameToFocus, locationToFocus); if (self._otherRequestInProgress) return; self._otherRequestInProgress = true; @@ -125,6 +126,7 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicing method: "GET", dataType: "json", success: function(response) { + console.log("requestData api/files/response", response); self.fromResponse(response, filenameToFocus, locationToFocus); self._otherRequestInProgress = false; }, @@ -357,7 +359,30 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicing }; self.onSlicingDone = function(payload) { - self.requestData(); + //self.requestData(); + jQuery('
', { + class: "safety_glasses_heads_up" + }).appendTo("#confirmation_dialog .confirmation_dialog_message"); + jQuery('
', { + class: "safety_glasses_warning", + text: gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!") + }).appendTo("#confirmation_dialog .confirmation_dialog_message"); + //$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!")); + $("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click"); + $("#confirmation_dialog .confirmation_dialog_acknowledge").click( + function(e) { + e.preventDefault(); + $("#confirmation_dialog").modal("hide"); + var url = API_BASEURL + "files/" + payload.gcode_location + "/" + payload.gcode; + $.ajax({ + url: url, + type: "POST", + dataType: "json", + contentType: "application/json; charset=UTF-8", + data: JSON.stringify({command: "select", print: true}) + }); + }); + $("#confirmation_dialog").modal("show"); }; self.onMetadataAnalysisFinished = function(payload) { diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 87041b62..a84ef034 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -938,7 +938,7 @@ class MachineCom(object): self.close() ### Operational - elif self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PAUSED: + elif self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PAUSED or self.STATE_LOCKED: #Request the temperature on comm timeout (every 5 seconds) when we are not printing. if line == "" or "wait" in line: if self._resendDelta is not None: @@ -951,7 +951,8 @@ class MachineCom(object): else: self._sendCommand("M105") - tempRequestTimeout = getNewTimeout("detection") if self._grbl else getNewTimeout("temperature") + tempRequestTimeout = getNewTimeout("detection") if self._grbl else getNewTimeout("position") + ###print(tempRequestTimeout) # resend -> start resend procedure from requested line elif line.lower().startswith("resend") or line.lower().startswith("rs"): @@ -979,7 +980,7 @@ class MachineCom(object): if time.time() > tempRequestTimeout and not self.isStreaming(): if self._grbl: self._commandQueue.put("?") - tempRequestTimeout = getNewTimeout("detection") + tempRequestTimeout = getNewTimeout("position") else: self._commandQueue.put("M105") tempRequestTimeout = getNewTimeout("temperature")