From a5d3e88f0a1db2b3aa68db42488b59bf62e4e6bb Mon Sep 17 00:00:00 2001 From: Wouter R Date: Sun, 14 Feb 2016 16:17:00 +0100 Subject: [PATCH] js/Printer.js: - change this.sendLength to Printer.MAX_LINES_PER_POST; - re-order object variable declarations. --- js/Printer.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/js/Printer.js b/js/Printer.js index 2330b4b..03dd5da 100644 --- a/js/Printer.js +++ b/js/Printer.js @@ -19,6 +19,7 @@ function setPrintprogress(val) { //*/ function Printer() { + /* CONSTANTS */ Printer.WIFIBOX_DISCONNECTED_STATE = "wifibox disconnected"; Printer.UNKNOWN_STATE = "unknown"; // happens when a printer is connection but there isn't communication yet @@ -32,6 +33,19 @@ function Printer() { Printer.ON_BEFORE_UNLOAD_MESSAGE = "You're doodle is still being sent to the printer, leaving will result in a incomplete 3D print"; + //after buffer full message has been received, wait until the buffer load is below this ratio before sending new data + Printer.GCODE_BUFFER_WAIT_LOAD_RATIO = 0.75; + Printer.BUFFER_SPACE_WAIT_TIMEOUT = 30000; // how often to recheck buffer load + + Printer.MAX_LINES_PER_POST = 500; // max amount of gcode lines per post (limited because WiFi box can't handle too much) + Printer.MAX_GCODE_SIZE = 10; // max size of gcode in MB's (estimation) + + // Events + Printer.UPDATE = "update"; + + + /* MEMBER VARIABLES */ + this.temperature = 0; this.targetTemperature = 0; this.currentLine = 0; @@ -50,7 +64,6 @@ function Printer() { this.sendPrintPartTimeoutTime = 5000; this.gcode; // gcode to be printed - this.sendLength = 500; // max amount of gcode lines per post (limited because WiFi box can't handle too much) this.retryDelay = 2000; // retry setTimout delay this.retrySendPrintPartDelay; // retry setTimout instance @@ -58,16 +71,10 @@ function Printer() { this.retryStopDelay; // retry setTimout instance this.retryPreheatDelay; // retry setTimout instance - //after buffer full message has been received, wait until the buffer load is below this ratio before sending new data - Printer.GCODE_BUFFER_WAIT_LOAD_RATIO = 0.75; - Printer.BUFFER_SPACE_WAIT_TIMEOUT = 30000; - - Printer.MAX_GCODE_SIZE = 10; // max size of gcode in MB's (estimation) - this.stateOverruled = false; - // Events - Printer.UPDATE = "update"; + + /* FUNCTIONS */ var self = this; @@ -148,7 +155,7 @@ function Printer() { //this.targetTemperature = settings["printer.temperature"]; // slight hack - this.sendPrintPart(this.sendIndex, this.sendLength); + this.sendPrintPart(this.sendIndex, Printer.MAX_LINES_PER_POST); } this.byteSize = function(s){