diff --git a/index.html b/index.html index c5520c2..fa32eb4 100755 --- a/index.html +++ b/index.html @@ -81,7 +81,6 @@
- diff --git a/js/Printer.js b/js/Printer.js index 10db8f3..83d0019 100644 --- a/js/Printer.js +++ b/js/Printer.js @@ -24,6 +24,8 @@ function Printer() { this.maxGCodeSize = 10; // max size of gcode in MB's (estimation) + this.sendStopGCodeDelay = 1000; + // Events Printer.UPDATE = "update"; @@ -133,6 +135,7 @@ function Printer() { this.stop = function() { console.log("Printer:stop"); var postData = { id: 0 }; + var self = this; $.ajax({ url: this.wifiboxURL + "/printer/stop", type: "POST", @@ -141,6 +144,8 @@ function Printer() { timeout: this.timeoutTime, success: function(data){ console.log("Printer:stop response: ", data); + + setTimeout(function() { console.log("send: ",gcodeEnd); self.print(gcodeEnd) },self.sendStopGCodeDelay); } }).fail(function() { console.log("Printer:stop: failed");