From 98e0418eb87f8391a1678cdc6ac8c2563e67e1c2 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 23 Oct 2013 18:42:47 +0200 Subject: [PATCH 1/3] Disable settings button if printer is busy or no control access. --- js_src/SettingsWindow.js | 89 +++++++++++++++++++++------------------ js_src/buttonbehaviors.js | 63 +++++++++++++++++---------- js_src/main.js | 13 ++++++ 3 files changed, 101 insertions(+), 64 deletions(-) diff --git a/js_src/SettingsWindow.js b/js_src/SettingsWindow.js index 9eb7191..9c56c0c 100644 --- a/js_src/SettingsWindow.js +++ b/js_src/SettingsWindow.js @@ -26,6 +26,11 @@ var settings = { } +//wrapper to prevent scoping issues in showSettings() +function openSettingsWindow() { + settingsWindow.showSettings(); +} + function SettingsWindow() { this.wifiboxURL; this.wifiboxCGIBinURL @@ -34,7 +39,7 @@ function SettingsWindow() { this.timeoutTime = 3000; this.retryDelay = 2000; // retry setTimout delay this.retryRetrieveNetworkStatusDelayTime = 1000;// retry setTimout delay - + this.retryLoadSettingsDelay; // retry setTimout instance this.retrySaveSettingsDelay; // retry setTimout instance this.retryRetrieveNetworkStatusDelay;// retry setTimout instance @@ -45,11 +50,11 @@ function SettingsWindow() { this.networks; this.currentNetwork; // the ssid of the network the box is on this.selectedNetwork; // the ssid of the selected network in the client mode settings - this.currentLocalIP = ""; + this.currentLocalIP = ""; this.clientModeState = SettingsWindow.NOT_CONNECTED; this.currentAP; this.apModeState = SettingsWindow.NO_AP; - + // after switching wifi network or creating a access point we delay the status retrieval // because the webserver needs time to switch this.retrieveNetworkStatusDelay; // setTimout delay @@ -63,28 +68,28 @@ function SettingsWindow() { SettingsWindow.CONNECTED = "connected"; SettingsWindow.CONNECTING = "connecting"; SettingsWindow.CONNECTING_FAILED = "connecting failed" - + // network access point mode states SettingsWindow.NO_AP = "no ap"; SettingsWindow.AP = "ap"; SettingsWindow.CREATING_AP = "creating ap"; - + SettingsWindow.API_CONNECTING_FAILED = -1 SettingsWindow.API_NOT_CONNECTED = 0 SettingsWindow.API_CONNECTING = 1 SettingsWindow.API_CONNECTED = 2 - SettingsWindow.API_CREATING = 3 - SettingsWindow.API_CREATED = 4 - + SettingsWindow.API_CREATING = 3 + SettingsWindow.API_CREATED = 4 + // network mode SettingsWindow.NETWORK_MODE_NEITHER = "neither"; SettingsWindow.NETWORK_MODE_CLIENT = "clientMode"; SettingsWindow.NETWORK_MODE_ACCESS_POINT = "accessPointMode"; - + this.networkMode = SettingsWindow.NETWORK_MODE_NEITHER; - + this.updatePanel = new UpdatePanel(); - + var self = this; this.init = function(wifiboxURL,wifiboxCGIBinURL) { @@ -100,7 +105,7 @@ function SettingsWindow() { self.form.submit(function (e) { self.submitwindow(e) }); self.loadSettings(); - + var btnAP = self.form.find("label[for='ap']"); var btnClient = self.form.find("label[for='client']"); var btnRefresh = self.form.find("#refreshNetworks"); @@ -116,7 +121,7 @@ function SettingsWindow() { btnConnect.on('touchstart mousedown',self.connectToNetwork); btnCreate.on('touchstart mousedown',self.createAP); networkSelector.change(self.networkSelectorChanged); - + // update panel var $updatePanelElement = self.form.find("#updatePanel"); self.updatePanel.init(wifiboxURL,$updatePanelElement); @@ -128,7 +133,7 @@ function SettingsWindow() { self.saveSettings(self.readForm(),function(){ self.hideSettings(); }); - + clearTimeout(self.retryRetrieveNetworkStatusDelay); } @@ -256,7 +261,7 @@ function SettingsWindow() { $(element).removeClass("error"); }); } - + this.readForm = function() { //console.log("SettingsWindow:readForm"); var settings = {}; @@ -341,7 +346,7 @@ function SettingsWindow() { } } }).fail(function() { - + }); } } @@ -357,22 +362,22 @@ function SettingsWindow() { success: function(response){ console.log("Settings:retrieveNetworkStatus response: ",response); if(response.status == "error") { - + } else { var data = response.data; - + if(typeof data.status === 'string') { data.status = parseInt(data.status); } //console.log(" data.status: ",data.status,data.statusMessage); - + // Determine which network settings to show switch(data.status) { case SettingsWindow.API_NOT_CONNECTED: //console.log(" not connected & not a access point"); self.apFieldSet.show(); self.clientFieldSet.show(); - + self.networkMode = SettingsWindow.NETWORK_MODE_NEITHER; break; case SettingsWindow.API_CONNECTING_FAILED: @@ -380,14 +385,14 @@ function SettingsWindow() { case SettingsWindow.API_CONNECTED: //console.log(" client mode"); self.form.find("#client").prop('checked',true); - + self.apFieldSet.hide(); self.clientFieldSet.show(); - + if(data.status == SettingsWindow.API_CONNECTED) { var networkSelector = self.form.find("#network"); networkSelector.val(data.ssid); - + self.currentNetwork = data.ssid; self.currentLocalIP = data.localip; self.selectNetwork(data.ssid); @@ -400,31 +405,31 @@ function SettingsWindow() { case SettingsWindow.API_CREATED: //console.log(" access point mode"); self.form.find("#ap").prop('checked',true); - + self.apFieldSet.show(); self.clientFieldSet.hide(); - + self.currentNetwork = undefined; self.selectNetwork(SettingsWindow.NOT_CONNECTED); var networkSelector = self.form.find("#network"); networkSelector.val(SettingsWindow.NOT_CONNECTED); - - if(data.ssid && data.status == SettingsWindow.API_CREATED) { + + if(data.ssid && data.status == SettingsWindow.API_CREATED) { self.currentAP = data.ssid; } self.networkMode = SettingsWindow.NETWORK_MODE_ACCESS_POINT; break; } self.updatePanel.setNetworkMode(self.networkMode); - + // update status message switch(data.status) { case SettingsWindow.API_CONNECTING_FAILED: - self.setClientModeState(SettingsWindow.CONNECTING_FAILED,data.statusMessage); + self.setClientModeState(SettingsWindow.CONNECTING_FAILED,data.statusMessage); self.setAPModeState(SettingsWindow.NO_AP,""); break; - case SettingsWindow.API_NOT_CONNECTED: - self.setClientModeState(SettingsWindow.NOT_CONNECTED,""); + case SettingsWindow.API_NOT_CONNECTED: + self.setClientModeState(SettingsWindow.NOT_CONNECTED,""); self.setAPModeState(SettingsWindow.NO_AP,""); break; case SettingsWindow.API_CONNECTING: @@ -436,15 +441,15 @@ function SettingsWindow() { self.setAPModeState(SettingsWindow.NO_AP,""); break; case SettingsWindow.API_CREATING: - self.setClientModeState(SettingsWindow.NOT_CONNECTED,""); + self.setClientModeState(SettingsWindow.NOT_CONNECTED,""); self.setAPModeState(SettingsWindow.CREATING_AP,""); break; case SettingsWindow.API_CREATED: - self.setClientModeState(SettingsWindow.NOT_CONNECTED,""); + self.setClientModeState(SettingsWindow.NOT_CONNECTED,""); self.setAPModeState(SettingsWindow.AP,""); break; } - + // Keep checking for updates? if(connecting) { switch(data.status) { @@ -495,7 +500,7 @@ function SettingsWindow() { this.form.find("#passwordLabel").hide(); this.form.find("#password").hide(); } - + this.setClientModeState = function(state,msg) { var field = this.form.find("#clientModeState"); var btnConnect = self.form.find("#connectToNetwork"); @@ -506,7 +511,7 @@ function SettingsWindow() { break; case SettingsWindow.CONNECTED: btnConnect.removeAttr("disabled"); - + var fieldText = "Connected to: "+this.currentNetwork+"."; if(this.currentLocalIP != undefined && this.currentLocalIP != "") { var a = ""+this.currentLocalIP+""; @@ -520,7 +525,7 @@ function SettingsWindow() { break; case SettingsWindow.CONNECTING_FAILED: btnConnect.removeAttr("disabled"); - field.html(msg); + field.html(msg); break; } this.clientModeState = state; @@ -555,10 +560,10 @@ function SettingsWindow() { } console.log(" postData: ",postData); if (communicateWithWifibox) { - + // save network related settings and on complete, connect to network self.saveSettings(self.readForm(),function() { - + $.ajax({ url: self.wifiboxCGIBinURL + "/network/associate", type: "POST", @@ -576,7 +581,7 @@ function SettingsWindow() { }); } self.setClientModeState(SettingsWindow.CONNECTING,""); - + // after switching wifi network or creating a access point we delay the status retrieval // because the webserver needs time to switch clearTimeout(self.retrieveNetworkStatusDelay); @@ -586,7 +591,7 @@ function SettingsWindow() { this.createAP = function() { console.log("createAP"); if (communicateWithWifibox) { - + // save network related settings and on complete, create access point self.saveSettings(self.readForm(),function() { self.setAPModeState(SettingsWindow.CREATING_AP); // get latest substituted ssid @@ -603,7 +608,7 @@ function SettingsWindow() { //clearTimeout(self.retrySaveSettingsDelay); //self.retrySaveSettingsDelay = setTimeout(function() { self.saveSettings() },self.retryDelay); // retry after delay }); - + self.setAPModeState(SettingsWindow.CREATING_AP,""); // after switching wifi network or creating a access point we delay the status retrieval diff --git a/js_src/buttonbehaviors.js b/js_src/buttonbehaviors.js index 8b8d01a..7ce03c4 100644 --- a/js_src/buttonbehaviors.js +++ b/js_src/buttonbehaviors.js @@ -160,11 +160,8 @@ function initButtonBehavior() { loadSettings(); }); }*/ - btnSettings.bind('touchstart mousedown',function () { - //e.preventDefault(); - //console.log("btnSettings clicked"); - settingsWindow.showSettings(); - }); + enableButton(btnSettings, openSettingsWindow); + // btnSettings.on('touchend', function(e) { // e.preventDefault(); // console.log("btnSettings touchend"); @@ -214,14 +211,14 @@ function print(e) { //setState(Printer.BUFFERING_STATE,printer.hasControl); printer.overruleState(Printer.BUFFERING_STATE); - + btnStop.css("display","none"); // hack - - // we put the gcode generation in a little delay + + // we put the gcode generation in a little delay // so that for example the print button is disabled right away clearTimeout(gcodeGenerateDelayer); - gcodeGenerateDelayer = setTimeout(function() { - + gcodeGenerateDelayer = setTimeout(function() { + var gcode = generate_gcode(); if (sendPrintCommands) { if(gcode.length > 0) { @@ -238,7 +235,7 @@ function print(e) { $("#textdump").text(""); $("#textdump").text(gcode.join("\n")); } - + }, gcodeGenerateDelay); } else { console.log("f:print >> not enough points!"); @@ -318,11 +315,11 @@ function update() { progressbar.update(printer.currentLine, printer.totalLines); } -function setState(newState,newHasControl) { +function setState(newState,newHasControl) { if(newState == state && newHasControl == hasControl) return; prevState = state; - + console.log("setState: ",prevState," > ",newState," ( ",newHasControl,")"); setDebugText("State: "+newState); @@ -350,38 +347,60 @@ function setState(newState,newHasControl) { // thermometer switch(newState) { - case Printer.IDLE_STATE: - case Printer.BUFFERING_STATE: - case Printer.PRINTING_STATE: + case Printer.IDLE_STATE: /* fall-through */ + case Printer.BUFFERING_STATE: /* fall-through */ + case Printer.PRINTING_STATE: /* fall-through */ case Printer.STOPPING_STATE: - thermometer.show(); + thermometer.show(); break; default: - thermometer.hide(); + thermometer.hide(); break; } // progress indicator switch(newState) { case Printer.PRINTING_STATE: - progressbar.show(); + progressbar.show(); break; default: progressbar.hide(); break; } - + + /* settings button */ + switch(newState) { + case Printer.IDLE_STATE: + enableButton(btnSettings, openSettingsWindow); + break; + case Printer.WIFIBOX_DISCONNECTED_STATE: /* fall-through */ + case Printer.BUFFERING_STATE: /* fall-through */ + case Printer.PRINTING_STATE: /* fall-through */ + case Printer.STOPPING_STATE: + disableButton(btnSettings); + break; + default: + enableButton(btnSettings, openSettingsWindow); + break; +} + if(newState == Printer.WIFIBOX_DISCONNECTED_STATE) { message.set("Lost connection to WiFi box",Message.ERROR); } else if(prevState == Printer.WIFIBOX_DISCONNECTED_STATE) { message.set("Connected to WiFi box",Message.INFO,true); } else if(newState == Printer.DISCONNECTED_STATE) { message.set("Printer disconnected",Message.WARNING,true); - } else if(prevState == Printer.DISCONNECTED_STATE && newState == Printer.IDLE_STATE || + } else if(prevState == Printer.DISCONNECTED_STATE && newState == Printer.IDLE_STATE || prevState == Printer.UNKNOWN_STATE && newState == Printer.IDLE_STATE) { message.set("Printer connected",Message.INFO,true); + } else if(prevState == Printer.PRINTING_STATE && newState == Printer.STOPPING_STATE) { + console.log("stopmsg show"); + message.set("Printer stopping",Message.INFO,false); + } else if(prevState == Printer.STOPPING_STATE && newState == Printer.IDLE_STATE) { + console.log("stopmsg hide"); + message.hide(); } - + state = newState; hasControl = newHasControl; } diff --git a/js_src/main.js b/js_src/main.js index e28694f..adc2a89 100644 --- a/js_src/main.js +++ b/js_src/main.js @@ -107,6 +107,19 @@ $(function() { } }); +function enableButton(elem, handler) { + //var elem = $('#'+domId); + elem.removeClass("disabled"); + elem.unbind('touchstart mousedown'); + elem.bind('touchstart mousedown', handler); +} + +function disableButton(elem) { + //var elem = $('#'+domId); + elem.addClass("disabled"); + elem.unbind('touchstart mousedown'); +} + function showOrHideThermo() { console.log("f:showOrHideThermo()"); if (showOrHide) { From 2e93202bfcfac0e47728405692373764a66490b5 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 23 Oct 2013 18:43:54 +0200 Subject: [PATCH 2/3] Fix spelling error. --- js_src/Printer.js | 106 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/js_src/Printer.js b/js_src/Printer.js index 45066b7..5895831 100644 --- a/js_src/Printer.js +++ b/js_src/Printer.js @@ -11,7 +11,7 @@ function setPrintprogress(val) { //*/ function Printer() { - + Printer.WIFIBOX_DISCONNECTED_STATE = "wifibox disconnected"; Printer.UNKNOWN_STATE = "unknown"; // happens when a printer is connection but there isn't communication yet Printer.DISCONNECTED_STATE = "disconnected"; // printer disconnected @@ -21,22 +21,22 @@ function Printer() { Printer.STOPPING_STATE = "stopping"; // when you stop (abort) a print it prints the endcode Printer.ON_BEFORE_UNLOAD_MESSAGE = "You're doodle is still being send to the printer, leaving will result in a incomplete 3D print"; - + this.temperature = 0; this.targetTemperature = 0; this.currentLine = 0; this.totalLines = 0; this.bufferedLines = 0; this.state = Printer.UNKNOWN_STATE; - this.hasControl = true; // whether this client has control access - - this.wifiboxURL; - + this.hasControl = true; // whether this client has control access + + this.wifiboxURL; + this.checkStatusInterval = 3000; this.checkStatusDelay; this.timeoutTime = 3000; this.sendPrintPartTimeoutTime = 5000; - + this.gcode; // gcode to be printed this.sendLength = 1500; // max amount of gcode lines per post (limited because WiFi box can't handle to much) @@ -45,16 +45,16 @@ function Printer() { this.retryCheckStatusDelay; // retry setTimout instance this.retryStopDelay; // retry setTimout instance this.retryPreheatDelay; // retry setTimout instance - + this.maxGCodeSize = 10; // max size of gcode in MB's (estimation) - + this.stateOverruled = false; - + // Events Printer.UPDATE = "update"; - + var self = this; - + this.init = function() { console.log("Printer:init"); //this.wifiboxURL = "http://" + window.location.host + "/cgi-bin/d3dapi"; @@ -62,21 +62,21 @@ function Printer() { this.wifiboxURL = wifiboxURL; //this.wifiboxURL = "proxy5.php"; console.log(" wifiboxURL: ",this.wifiboxURL); - + if(autoUpdate) { this.startStatusCheckInterval(); } } - + 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({ @@ -91,7 +91,7 @@ function Printer() { self.retryPreheatDelay = setTimeout(function() { self.preheat() },self.retryDelay); // retry after delay } } - }).fail(function() { + }).fail(function() { console.log("Printer:preheat: failed"); clearTimeout(self.retryPreheatDelay); self.retryPreheatDelay = setTimeout(function() { self.preheat() },self.retryDelay); // retry after delay @@ -100,34 +100,34 @@ function Printer() { console.log ("Printer >> f:preheat() >> communicateWithWifibox is false, so not executing this function"); } } - + this.print = function(gcode) { console.log("Printer:print"); console.log(" gcode total # of lines: " + gcode.length); - + message.set("Sending doodle to printer...",Message.NOTICE); self.addLeaveWarning(); - + /*for (i = 0; i < gcode.length; i++) { gcode[i] += " (" + i + ")"; }*/ - + this.sendIndex = 0; this.gcode = gcode; - + //console.log(" gcode[20]: ",gcode[20]); var gcodeLineSize = this.byteSize(gcode[20]); //console.log(" gcodeLineSize: ",gcodeLineSize); var gcodeSize = gcodeLineSize*gcode.length/1024/1024; // estimate gcode size in MB's console.log(" gcodeSize: ",gcodeSize); - + if(gcodeSize > this.maxGCodeSize) { console.log("Error: Printer:print: gcode file is probably to big ("+gcodeSize+"MB) (max: "+this.maxGCodeSize+"MB)"); return; } - + //this.targetTemperature = settings["printer.temperature"]; // slight hack - + this.sendPrintPart(this.sendIndex, this.sendLength); } this.byteSize = function(s){ @@ -135,10 +135,10 @@ function Printer() { } this.sendPrintPart = function(sendIndex,sendLength) { console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength); - + var firstOne = (sendIndex == 0)? true : false; var start = firstOne; // start printing right away - + var completed = false; if (this.gcode.length < (sendIndex + sendLength)) { console.log(" sending less than max sendLength (and last)"); @@ -147,7 +147,7 @@ function Printer() { completed = true; } var gcodePart = this.gcode.slice(sendIndex, sendIndex+sendLength); - + var postData = { gcode: gcodePart.join("\n"), first: firstOne, start: start}; var self = this; if (communicateWithWifibox) { @@ -159,19 +159,19 @@ function Printer() { timeout: this.sendPrintPartTimeoutTime, success: function(data){ console.log("Printer:sendPrintPart response: ",data); - + if(data.status == "success") { if (completed) { console.log("Printer:sendPrintPart:gcode sending completed"); this.gcode = []; btnStop.css("display","block"); // hack self.removeLeaveWarning(); - message.set("Doodle is sent to printer...",Message.INFO,true); + message.set("Doodle has been 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 - - console.log("Printer:sendPrintPart:gcode part received (state: ",self.state,")"); + + console.log("Printer:sendPrintPart:gcode part received (state: ",self.state,")"); if(self.state == Printer.PRINTING_STATE || self.state == Printer.BUFFERING_STATE) { console.log("Printer:sendPrintPart:sending next part"); self.sendPrintPart(sendIndex + sendLength, sendLength); @@ -179,22 +179,22 @@ function Printer() { } } // after we know the first gcode packed has bin received or failed - // (and the driver had time to update the printer.state) + // (and the driver had time to update the printer.state) // we start checking the status again if(sendIndex == 0) { self.startStatusCheckInterval(); } } - }).fail(function() { + }).fail(function() { console.log("Printer:sendPrintPart: failed"); clearTimeout(self.retrySendPrintPartDelay); self.retrySendPrintPartDelay = setTimeout(function() { console.log("request printer:sendPrintPart failed retry"); - self.sendPrintPart(sendIndex, sendLength) + self.sendPrintPart(sendIndex, sendLength) },self.retryDelay); // retry after delay - + // after we know the gcode packed has bin received or failed - // (and the driver had time to update the printer.state) + // (and the driver had time to update the printer.state) // we start checking the status again self.startStatusCheckInterval(); }); @@ -202,7 +202,7 @@ function Printer() { console.log ("Printer >> f:sendPrintPart() >> communicateWithWifibox is false, so not executing this function"); } } - + this.stop = function() { console.log("Printer:stop"); var self = this; @@ -214,19 +214,19 @@ function Printer() { timeout: this.timeoutTime, success: function(data){ console.log("Printer:stop response: ", data); - + // after we know the stop has bin received or failed - // (and the driver had time to update the printer.state) + // (and the driver had time to update the printer.state) // we start checking the status again self.startStatusCheckInterval(); } - }).fail(function() { + }).fail(function() { console.log("Printer:stop: failed"); clearTimeout(self.retryStopDelay); self.retryStopDelay = setTimeout(function() { self.stop() },self.retryDelay); // retry after delay - + // after we know the stop has bin received or failed - // (and the driver had time to update the printer.state) + // (and the driver had time to update the printer.state) // we start checking the status again self.startStatusCheckInterval(); }); @@ -258,9 +258,9 @@ function Printer() { timeout: this.timeoutTime, success: function(response){ //console.log(" Printer:status: ",response.data.state); //," response: ",response); - + self.handleStatusUpdate(response); - + clearTimeout(self.checkStatusDelay); clearTimeout(self.retryCheckStatusDelay); self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval); @@ -289,11 +289,11 @@ function Printer() { self.state = data.state; //console.log(" state > ",self.state); } - + // temperature self.temperature = data.hotend; self.targetTemperature = data.hotend_target; - + // progress self.currentLine = data.current_line; self.totalLines = data.total_lines; @@ -301,7 +301,7 @@ function Printer() { // access self.hasControl = data.has_control; - + if(self.state == Printer.PRINTING_STATE || self.state == Printer.STOPPING_STATE) { console.log("progress: ",self.currentLine+"/"+self.totalLines+" ("+self.bufferedLines+") ("+self.state+")"); } @@ -311,14 +311,14 @@ function Printer() { this.overruleState = function(newState) { this.stateOverruled = true; console.log(" stateOverruled: ",this.stateOverruled); - + self.state = newState; - + $(document).trigger(Printer.UPDATE); - + this.stopStatusCheckInterval(); } - + this.removeLeaveWarning = function() { window.onbeforeunload = null; } @@ -327,4 +327,4 @@ function Printer() { return Printer.ON_BEFORE_UNLOAD_MESSAGE; }; } -} \ No newline at end of file +} From c1160c60a7adc5feeb6b714b697476c411618d8e Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 23 Oct 2013 18:46:13 +0200 Subject: [PATCH 3/3] Warning text improvement --- js_src/gcodeGenerating.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js_src/gcodeGenerating.js b/js_src/gcodeGenerating.js index d75bc23..0ca084a 100644 --- a/js_src/gcodeGenerating.js +++ b/js_src/gcodeGenerating.js @@ -142,7 +142,7 @@ function generate_gcode() { console.log("pointsToPrint: ",pointsToPrint); if(pointsToPrint > MAX_POINTS_TO_PRINT) { - alert("Sorry, your doodle too complex and / or to high"); + alert("Sorry, your doodle is too complex or too high. Please try to simplify it."); console.log("ERROR: to many points too convert to gcode"); return []; }