diff --git a/js_src/Message.js b/js_src/Message.js index dc3cab3..54c347e 100644 --- a/js_src/Message.js +++ b/js_src/Message.js @@ -10,7 +10,7 @@ function Message() { this.$element; var self = this; - var autoHideDelay = 2000; + var autoHideDelay = 5000; var autohideTimeout; this.init = function($element) { diff --git a/js_src/Printer.js b/js_src/Printer.js index 5cf9e78..5e245c9 100644 --- a/js_src/Printer.js +++ b/js_src/Printer.js @@ -46,7 +46,7 @@ function Printer() { this.retryStopDelay; // retry setTimout instance this.retryPreheatDelay; // retry setTimout instance - this.maxGCodeSize = 10; // max size of gcode in MB's (estimation) + Printer.MAX_GCODE_SIZE = 10; // max size of gcode in MB's (estimation) this.stateOverruled = false; @@ -70,6 +70,13 @@ function Printer() { this.preheat = function() { console.log("Printer:preheat"); + + if( this.state == Printer.BUFFERING_STATE || + this.state == Printer.PRINTING_STATE || + this.state == Printer.STOPPING_STATE) { + return; + } + var self = this; if (communicateWithWifibox) { $.ajax({ @@ -114,7 +121,8 @@ function Printer() { var gcodeSize = gcodeLineSize*gcode.length/1024/1024; // estimate gcode size in MB's console.log(" gcodeSize: ",gcodeSize); - if(gcodeSize > this.maxGCodeSize) { + if(gcodeSize > Printer.MAX_GCODE_SIZE) { + alert("Error: Printer:print: gcode file is probably to big ("+gcodeSize+"MB) (max: "+this.maxGCodeSize+"MB)"); console.log("Error: Printer:print: gcode file is probably to big ("+gcodeSize+"MB) (max: "+this.maxGCodeSize+"MB)"); return; } @@ -159,7 +167,7 @@ function Printer() { this.gcode = []; btnStop.css("display","block"); // hack self.removeLeaveWarning(); - message.set("Doodle is send to printer...",Message.INFO,true); + message.set("Doodle is sent to printer...",Message.INFO,true); //self.targetTemperature = settings["printer.temperature"]; // slight hack } else { // only if the state hasn't bin changed (by for example pressing stop) we send more gcode diff --git a/js_src/SettingsWindow.js b/js_src/SettingsWindow.js index 9eb7191..c345fcf 100644 --- a/js_src/SettingsWindow.js +++ b/js_src/SettingsWindow.js @@ -245,16 +245,13 @@ function SettingsWindow() { } this.displayValidationError = function(key,msg) { var formElement = self.form.find("[name|='"+key+"']"); - console.log("formElement: ",formElement); formElement.addClass("error"); var errorMsg = "

"+msg+"

" formElement.after(errorMsg); } this.clearValidationErrors = function() { - var formElements = self.form.find(".error"); - formElements.each( function(index,element) { - $(element).removeClass("error"); - }); + self.form.find(".errorMsg").remove(); + self.form.find(".error").removeClass("error"); } this.readForm = function() { diff --git a/js_src/gcodeGenerating.js b/js_src/gcodeGenerating.js index 8cd3a4c..ca37665 100644 --- a/js_src/gcodeGenerating.js +++ b/js_src/gcodeGenerating.js @@ -25,7 +25,7 @@ gcodeEnd.push("G90"); // absolute positioning gcodeEnd.push("M117 Done "); // display message (20 characters to clear whole screen)*/ -var MAX_POINTS_TO_PRINT = 400000; //80000; //40000; +var MAX_POINTS_TO_PRINT = 200000; //400000; //80000; //40000; var gcode = []; function generate_gcode() { @@ -139,9 +139,11 @@ function generate_gcode() { //console.log(" pointsToPrint: ",pointsToPrint); //console.log(" MAX_POINTS_TO_PRINT: ",MAX_POINTS_TO_PRINT); + console.log("pointsToPrint: ",pointsToPrint); + if(pointsToPrint > MAX_POINTS_TO_PRINT) { alert("Sorry, your doodle to to complex and / or to high"); - console.log("WARNING: to many points to convert to gcode"); + console.log("ERROR: to many points to convert to gcode"); return []; }