From 4c0e927480403fb10388ae107de92e842ea2f9ab Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 16 Aug 2013 19:27:48 +0200 Subject: [PATCH] Sending end GCode at manual stop --- index.html | 1 - js/Printer.js | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 5a7a2e9..7be8720 100755 --- a/index.html +++ b/index.html @@ -80,7 +80,6 @@
- diff --git a/js/Printer.js b/js/Printer.js index aa6ddf9..2f66e65 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");