From ce489112e8335f222668bcd530abafc446ef61eb Mon Sep 17 00:00:00 2001 From: Wouter R Date: Mon, 24 Feb 2014 15:48:39 +0100 Subject: [PATCH 01/12] Add button to include/exclude beta releases. --- js/settings/UpdatePanel.js | 16 +++++++++++++++- www/css/settings.css | 2 +- www/settings.html | 11 ++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/js/settings/UpdatePanel.js b/js/settings/UpdatePanel.js index 6594d0b..6d24a6e 100644 --- a/js/settings/UpdatePanel.js +++ b/js/settings/UpdatePanel.js @@ -7,6 +7,8 @@ */ function UpdatePanel() { + var _form = new FormPanel(); + this.wifiboxURL; this.element; @@ -40,24 +42,34 @@ function UpdatePanel() { var self = this; this.init = function(wifiboxURL,updatePanelElement) { + _form.init(wifiboxURL,wifiboxURL,updatePanelElement); this.wifiboxURL = wifiboxURL; this.element = updatePanelElement; this.retainCheckbox = this.element.find("#retainConfiguration"); + this.includeBetasCheckbox = this.element.find("#includeBetas"); this.btnUpdate = this.element.find("#update"); this.statusDisplay = this.element.find("#updateState"); this.infoDisplay = this.element.find("#updateInfo"); this.retainCheckbox.change(this.retainChanged); + this.includeBetasCheckbox.change(this.includeBetasChanged); this.btnUpdate.click(this.update); this.checkStatus(false); } this.retainChanged = function(e) { //console.log("UpdatePanel:retainChanged"); + //this call ensures that the update button gets enabled if (!retainChanged && !canUpdate) self.setState(self.state,true); } + this.includeBetasChanged = function() { + //console.log("UpdatePanel:includeBetasChanged"); + _form.saveSettings(_form.readForm(),function(validated, data) { + if(validated) self.checkStatus(false); + }); + } this.update = function() { console.log("UpdatePanel:update"); self.downloadUpdate(); @@ -149,6 +161,8 @@ function UpdatePanel() { this.handleStatusData = function(data) { //console.log("UpdatePanel:handleStatusData"); + var refreshUI = (self.canUpdate != data.can_update); + self.canUpdate = data.can_update; if(self.currentVersion != data.current_version || self.newestVersion != data.newest_version) { @@ -161,7 +175,7 @@ function UpdatePanel() { self.progress = data.progress; // not always available self.imageSize = data.image_size; // not always available - self.setState(data.state_code); + self.setState(data.state_code, refreshUI); switch(this.state){ case UpdatePanel.IMAGE_READY: diff --git a/www/css/settings.css b/www/css/settings.css index dc6a6cf..25b1360 100644 --- a/www/css/settings.css +++ b/www/css/settings.css @@ -137,7 +137,7 @@ form dl dt { font-style: italic; width: 10em; } -#updatePanel #retainConfigurationLabel { +#updatePanel #retainConfigurationLabel, #updatePanel #includeBetasLabel { display: inline; float: none; } \ No newline at end of file diff --git a/www/settings.html b/www/settings.html index 943d441..147601e 100644 --- a/www/settings.html +++ b/www/settings.html @@ -52,7 +52,7 @@ -->
- + x:mm
@@ -80,7 +80,7 @@
{preheatBedTemp}
Preheat bed temperature
{printerType}
Printer type
{if heatedBed}
Enable line if printer has heated bed
- + @@ -165,8 +165,9 @@
Update - -

+
+
+

@@ -178,7 +179,7 @@
- +
Restore From afb279fbc76f2fa0def81977a36a55e8739d6cea Mon Sep 17 00:00:00 2001 From: Wouter R Date: Mon, 24 Feb 2014 15:58:50 +0100 Subject: [PATCH 02/12] Whitespace fixes. --- js/settings/UpdatePanel.js | 108 ++++++++++++++++---------------- www/css/settings.css | 125 +++++++++++++++++++++++-------------- 2 files changed, 131 insertions(+), 102 deletions(-) diff --git a/js/settings/UpdatePanel.js b/js/settings/UpdatePanel.js index 6d24a6e..dc6c33d 100644 --- a/js/settings/UpdatePanel.js +++ b/js/settings/UpdatePanel.js @@ -11,52 +11,52 @@ function UpdatePanel() { this.wifiboxURL; this.element; - - this.statusCheckInterval = 1000; - this.statusCheckDelayer; // setTimout instance - this.installedDelay = 90*1000; // Since we can't retrieve status during installation we show the installed text after a fixed delay - this.installedDelayer; // setTimout instance - this.retryDelay = 1000; - this.retryDelayer; // setTimout instance - //this.timeoutTime = 3000; - - this.canUpdate = false; - this.currentVersion = ""; - this.newestVersion; + + this.statusCheckInterval = 1000; + this.statusCheckDelayer; // setTimout instance + this.installedDelay = 90*1000; // Since we can't retrieve status during installation we show the installed text after a fixed delay + this.installedDelayer; // setTimout instance + this.retryDelay = 1000; + this.retryDelayer; // setTimout instance + //this.timeoutTime = 3000; + + this.canUpdate = false; + this.currentVersion = ""; + this.newestVersion; this.progress; this.imageSize; var _inAccessPointMode; - + // states from api, see Doodle3D firmware src/script/d3d-updater.lua - UpdatePanel.NONE = 1; // default state - UpdatePanel.DOWNLOADING = 2; - UpdatePanel.DOWNLOAD_FAILED = 3; - UpdatePanel.IMAGE_READY = 4; // download successfull and checked - UpdatePanel.INSTALLING = 5; - UpdatePanel.INSTALLED = 6; - UpdatePanel.INSTALL_FAILED = 7; - - this.state; // update state from api - this.stateText = ""; // update state text from api - + UpdatePanel.NONE = 1; // default state + UpdatePanel.DOWNLOADING = 2; + UpdatePanel.DOWNLOAD_FAILED = 3; + UpdatePanel.IMAGE_READY = 4; // download successfull and checked + UpdatePanel.INSTALLING = 5; + UpdatePanel.INSTALLED = 6; + UpdatePanel.INSTALL_FAILED = 7; + + this.state; // update state from api + this.stateText = ""; // update state text from api + var self = this; this.init = function(wifiboxURL,updatePanelElement) { _form.init(wifiboxURL,wifiboxURL,updatePanelElement); - + this.wifiboxURL = wifiboxURL; - + this.element = updatePanelElement; this.retainCheckbox = this.element.find("#retainConfiguration"); this.includeBetasCheckbox = this.element.find("#includeBetas"); this.btnUpdate = this.element.find("#update"); this.statusDisplay = this.element.find("#updateState"); this.infoDisplay = this.element.find("#updateInfo"); - + this.retainCheckbox.change(this.retainChanged); this.includeBetasCheckbox.change(this.includeBetasChanged); this.btnUpdate.click(this.update); - + this.checkStatus(false); } this.retainChanged = function(e) { @@ -91,11 +91,11 @@ function UpdatePanel() { } this.installUpdate = function() { console.log("UpdatePanel:installUpdate"); - + // should personal sketches and settings be retained over update? var retain = self.retainCheckbox.prop('checked'); console.log(" retain: ",retain); - + self.stopCheckingStatus(); postData = {no_retain:!retain} $.ajax({ @@ -110,11 +110,11 @@ function UpdatePanel() { //console.log("UpdatePanel:installUpdate: no respons (there shouldn't be)"); }); self.setState(UpdatePanel.INSTALLING); - + clearTimeout(self.installedDelayer); self.installedDelayer = setTimeout(function() { self.setState(UpdatePanel.INSTALLED) },self.installedDelay); } - + this.startCheckingStatus = function() { clearTimeout(self.statusCheckDelayer); clearTimeout(self.retryDelayer); @@ -125,7 +125,7 @@ function UpdatePanel() { clearTimeout(self.retryDelayer); } this.checkStatus = function(keepChecking) { - if (!communicateWithWifibox) return; + if (!communicateWithWifibox) return; $.ajax({ url: self.wifiboxURL + "/update/status", type: "GET", @@ -133,18 +133,18 @@ function UpdatePanel() { //timeout: self.timeoutTime, success: function(response){ console.log("UpdatePanel:checkStatus response: ",response); - + // Keep checking ? if(keepChecking) { switch(self.state){ - case UpdatePanel.DOWNLOADING: + case UpdatePanel.DOWNLOADING: case UpdatePanel.INSTALLING: clearTimeout(self.statusCheckDelayer); self.statusCheckDelayer = setTimeout(function() { self.checkStatus(keepChecking) },self.statusCheckInterval); break; } } - + if(response.status != "error") { var data = response.data; self.handleStatusData(data); @@ -158,25 +158,25 @@ function UpdatePanel() { } }); } - + this.handleStatusData = function(data) { //console.log("UpdatePanel:handleStatusData"); var refreshUI = (self.canUpdate != data.can_update); self.canUpdate = data.can_update; - + if(self.currentVersion != data.current_version || self.newestVersion != data.newest_version) { self.currentVersion = data.current_version; self.newestVersion = data.newest_version; self.updateInfoDisplay(); } - + self.stateText = data.state_text; self.progress = data.progress; // not always available self.imageSize = data.image_size; // not always available - + self.setState(data.state_code, refreshUI); - + switch(this.state){ case UpdatePanel.IMAGE_READY: self.installUpdate(); @@ -188,19 +188,19 @@ function UpdatePanel() { if(!refresh && this.state == newState) return; console.log("UpdatePanel:setState: ",this.state," > ",newState,"(",this.stateText,") (in Access Point Mode: ",_inAccessPointMode,") (newestVersion: ",self.newestVersion,") (refresh: ",refresh,")"); this.state = newState; - + // should personal sketches and settings be retained over update? var retain = self.retainCheckbox.prop('checked'); //console.log(" retain", retain); - + // download button - // if there isn't newestVersion data something went wrong, + // if there isn't newestVersion data something went wrong, // probably accessing the internet //console.log(" self.newestVersion: ",self.newestVersion); if(self.newestVersion != undefined) { //console.log(" this.state: ",this.state); switch(this.state){ - case UpdatePanel.NONE: + case UpdatePanel.NONE: case UpdatePanel.DOWNLOAD_FAILED: case UpdatePanel.INSTALL_FAILED: //console.log(" self.canUpdate: ",self.canUpdate); @@ -212,7 +212,7 @@ function UpdatePanel() { break; default: self.btnUpdate.attr("disabled", true); - break; + break; } } else { self.btnUpdate.attr("disabled", true); @@ -230,23 +230,23 @@ function UpdatePanel() { text = "You're up to date."; } break; - case UpdatePanel.DOWNLOADING: + case UpdatePanel.DOWNLOADING: text = "Downloading update..."; break; - case UpdatePanel.DOWNLOAD_FAILED: + case UpdatePanel.DOWNLOAD_FAILED: text = "Downloading update failed."; break; - case UpdatePanel.IMAGE_READY: + case UpdatePanel.IMAGE_READY: text = "Update downloaded."; break; - case UpdatePanel.INSTALLING: + case UpdatePanel.INSTALLING: text = "Installing update... (will take a minute)"; break; - case UpdatePanel.INSTALLED: + case UpdatePanel.INSTALLED: text = "Update complete, please reconnect by connecting your device to the access point of your WiFi box and going to draw.doodle3d.com"; //text = "Update complete, please refresh Page."; break; - case UpdatePanel.INSTALL_FAILED: + case UpdatePanel.INSTALL_FAILED: text = "Installing update failed."; break; } @@ -261,10 +261,10 @@ function UpdatePanel() { } this.updateInfoDisplay = function() { var html = 'Current version: ' + self.currentVersion + - ' (release notes). '; + ' (release notes). '; if(self.canUpdate) { html += 'Latest version: ' + self.newestVersion + - ' (release notes).'; + ' (release notes).'; } self.infoDisplay.html(html); } diff --git a/www/css/settings.css b/www/css/settings.css index 25b1360..01b4425 100644 --- a/www/css/settings.css +++ b/www/css/settings.css @@ -1,143 +1,172 @@ form { - margin: 10px; - max-width: 600px; + margin: 10px; + max-width: 600px; } + form input { - margin: 1px; + margin: 1px; } body,th,td { - font-family: Helvetica, Arial, "Nimbus Sans L", sans-serif; - font-size: 13px; + font-family: Helvetica, Arial, "Nimbus Sans L", sans-serif; + font-size: 13px; } + .settingsContainer { - position:relative; - /*min-width: 370px;*/ - width: 100%; - height: 100%; + position: relative; + /*min-width: 370px;*/ + width: 100%; + height: 100%; } /*form#settingsForm {*/ - /*width: 100% auto;*/ +/*width: 100% auto;*/ /*}*/ form fieldset { - max-width: 600px; - border: 1px solid rgb(187, 187, 187); + max-width: 600px; + border: 1px solid rgb(187, 187, 187); border-radius: 5px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - margin-bottom: 20px; - padding: 8px; - /*padding-right: 8px;*/ + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + margin-bottom: 20px; + padding: 8px; + /*padding-right: 8px;*/ } -form fieldset fieldset{ + +form fieldset fieldset { max-width: 580px; margin: 15px 0 5px 0; clear: left; float: left; } + form fieldset.collapsed { border-radius: 0; -webkit-border-radius: 0; -moz-border-radius: 0; border-width: 1px 0 0 0; - float:none; + float: none; } + form fieldset.collapsible { padding: 0; } -form fieldset.collapsible div{ + +form fieldset.collapsible div { margin: 8px; } + form fieldset legend { - margin-left: 10px; - font-weight: bold; + margin-left: 10px; + font-weight: bold; } + form fieldset.collapsible legend { padding-left: 10px; cursor: pointer; } + form fieldset.expanded legend { - background: transparent url(../img/buttons/expanded.gif) no-repeat center left; + background: transparent url(../img/buttons/expanded.gif) no-repeat + center left; } + form fieldset.collapsed legend { - background: transparent url(../img/buttons/collapsed.gif) no-repeat center left; + background: transparent url(../img/buttons/collapsed.gif) no-repeat + center left; } form label { - min-width: 150px; - display: block; - float: left; - margin: 1px 0 0 0; + min-width: 150px; + display: block; + float: left; + margin: 1px 0 0 0; clear: left; } + form div { float: left; } -form input[type="text"], form input[type="number"], form input[type="password"] { - border: 1px solid rgb(144, 192, 255); - margin-right: 5px; - -webkit-border-radius: 4px; + +form input[type="text"],form input[type="number"], form input[type="password"] + { + border: 1px solid rgb(144, 192, 255); + margin-right: 5px; + -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } -form input[type="text"].small, form input[type="number"].small, form input[type="password"].small { - width: 50px; + +form input[type="text"].small,form input[type="number"].small, form input[type="password"].small + { + width: 50px; } -form input[type="text"].large, form input[type="number"].large, form input[type="password"].large { - width: 250px; + +form input[type="text"].large,form input[type="number"].large, form input[type="password"].large + { + width: 250px; } + form input[type="radio"] { - margin: 4px 4px 0 0; + margin: 4px 4px 0 0; } form textarea { - border: 1px solid rgb(144, 192, 255); - -webkit-border-radius: 5px; + border: 1px solid rgb(144, 192, 255); + -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } + form .startgcode_left { - float:left; - margin-right: 20px; + float: left; + margin-right: 20px; } + form textarea.gcode { - width: 252px; - /*max-width: 262px;*/ - /*min-width: 200px;*/ - height: 150px; + width: 252px; + /*max-width: 262px;*/ + /*min-width: 200px;*/ + height: 150px; } + form small { margin: 3px 0 0 0; display: block; clear: left; } + form .button { display: inline-block; } -form #passwordLabel, form #password { +form #passwordLabel,form #password { display: none; } form input.error, form textarea.error, form select.error { border: #f00 solid 2px; } + form .errorMsg { color: #f00; margin: 0 0 0 1em; } + form .intro { margin: 0 0 0.5em 0; } -form dl { + +form dl { margin: 0.5em 0 0 0; } + form dl dt { float: left; font-style: italic; width: 10em; } + #updatePanel #retainConfigurationLabel, #updatePanel #includeBetasLabel { display: inline; float: none; -} \ No newline at end of file +} From 0b52f928ca3eddb7c63b6bcd4eefa11a0fee2dcc Mon Sep 17 00:00:00 2001 From: Wouter R Date: Mon, 24 Feb 2014 17:26:34 +0100 Subject: [PATCH 03/12] Show different text when able to switch from beta to stable release. --- js/settings/UpdatePanel.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/settings/UpdatePanel.js b/js/settings/UpdatePanel.js index dc6c33d..a174879 100644 --- a/js/settings/UpdatePanel.js +++ b/js/settings/UpdatePanel.js @@ -31,7 +31,7 @@ function UpdatePanel() { UpdatePanel.NONE = 1; // default state UpdatePanel.DOWNLOADING = 2; UpdatePanel.DOWNLOAD_FAILED = 3; - UpdatePanel.IMAGE_READY = 4; // download successfull and checked + UpdatePanel.IMAGE_READY = 4; // download successful and checked UpdatePanel.INSTALLING = 5; UpdatePanel.INSTALLED = 6; UpdatePanel.INSTALL_FAILED = 7; @@ -148,6 +148,8 @@ function UpdatePanel() { if(response.status != "error") { var data = response.data; self.handleStatusData(data); + } else { + console.log("API update/status call returned an error: '" + response.msg + "'"); } } }).fail(function() { @@ -225,7 +227,9 @@ function UpdatePanel() { switch(this.state){ case UpdatePanel.NONE: if(self.canUpdate) { - text = "Update(s) available."; + var settings = _form.readForm(); + if (self.versionIsBeta(self.currentVersion) && !settings.includeBetas) text = "You can switch back to the latest stable release."; + else text = "Update(s) available."; } else { text = "You're up to date."; } @@ -273,4 +277,8 @@ function UpdatePanel() { _inAccessPointMode = inAccessPointMode; self.updateStatusDisplay(); } + + this.versionIsBeta = function(version) { + return version.match(/.*-.*/g) != null; + } } From 9a620fd9ced7dd251a645f8d4a989a28cb8e9504 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Tue, 25 Feb 2014 17:06:08 +0100 Subject: [PATCH 04/12] Display more specific texts in update panel. Fix minor bugs in update code. Display release dates of updates. --- js/settings/UpdatePanel.js | 58 ++++++++++++++++++++++++++++++++------ www/settings.html | 2 +- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/js/settings/UpdatePanel.js b/js/settings/UpdatePanel.js index a174879..f1d9dcb 100644 --- a/js/settings/UpdatePanel.js +++ b/js/settings/UpdatePanel.js @@ -23,6 +23,8 @@ function UpdatePanel() { this.canUpdate = false; this.currentVersion = ""; this.newestVersion; + this.currentReleaseDate; + this.newestReleaseDate; this.progress; this.imageSize; var _inAccessPointMode; @@ -59,21 +61,26 @@ function UpdatePanel() { this.checkStatus(false); } + this.retainChanged = function(e) { //console.log("UpdatePanel:retainChanged"); //this call ensures that the update button gets enabled if (!retainChanged && !canUpdate) self.setState(self.state,true); } + this.includeBetasChanged = function() { //console.log("UpdatePanel:includeBetasChanged"); _form.saveSettings(_form.readForm(),function(validated, data) { if(validated) self.checkStatus(false); }); } + + this.update = function() { console.log("UpdatePanel:update"); self.downloadUpdate(); } + this.downloadUpdate = function() { console.log("UpdatePanel:downloadUpdate"); $.ajax({ @@ -89,6 +96,7 @@ function UpdatePanel() { self.setState(UpdatePanel.DOWNLOADING); self.startCheckingStatus(); } + this.installUpdate = function() { console.log("UpdatePanel:installUpdate"); @@ -115,15 +123,18 @@ function UpdatePanel() { self.installedDelayer = setTimeout(function() { self.setState(UpdatePanel.INSTALLED) },self.installedDelay); } + this.startCheckingStatus = function() { clearTimeout(self.statusCheckDelayer); clearTimeout(self.retryDelayer); self.statusCheckDelayer = setTimeout(function() { self.checkStatus(true) },self.statusCheckInterval); } + this.stopCheckingStatus = function() { clearTimeout(self.statusCheckDelayer); clearTimeout(self.retryDelayer); } + this.checkStatus = function(keepChecking) { if (!communicateWithWifibox) return; $.ajax({ @@ -161,15 +172,19 @@ function UpdatePanel() { }); } + this.handleStatusData = function(data) { //console.log("UpdatePanel:handleStatusData"); - var refreshUI = (self.canUpdate != data.can_update); + //status texts and button state might have to be updated if the newest version changes (e.g., after (un)ticking include betas checkbox) + var refreshUI = (self.newestVersion != data.newest_version); self.canUpdate = data.can_update; if(self.currentVersion != data.current_version || self.newestVersion != data.newest_version) { self.currentVersion = data.current_version; self.newestVersion = data.newest_version; + self.currentReleaseDate = data.current_release_date; // not always available (for older versions) + self.newestReleaseDate = data.newest_release_date; // not always available (for older versions) self.updateInfoDisplay(); } @@ -185,6 +200,7 @@ function UpdatePanel() { break; } } + this.setState = function(newState,refresh) { //console.log("UpdatePanel:setState"); if(!refresh && this.state == newState) return; @@ -221,15 +237,25 @@ function UpdatePanel() { } this.updateStatusDisplay(); } + this.updateStatusDisplay = function() { var text = ""; if(self.newestVersion != undefined) { switch(this.state){ case UpdatePanel.NONE: if(self.canUpdate) { - var settings = _form.readForm(); - if (self.versionIsBeta(self.currentVersion) && !settings.includeBetas) text = "You can switch back to the latest stable release."; - else text = "Update(s) available."; + var currIsBeta = self.versionIsBeta(self.currentVersion); + var newIsBeta = self.versionIsBeta(self.newestVersion); + var relIsNewer = (self.newestReleaseDate && self.currentReleaseDate) ? (self.newestReleaseDate - self.currentReleaseDate > 0) : true; + + if (!newIsBeta) { + if (relIsNewer) text = "Update available."; + else text = "You can switch back to the latest stable release."; //this case is always a beta->stable 'downgrade' + } else { + //NOTE: actually, an older beta will never be presented as update by the API + var prefixText = currIsBeta ? "A" : (relIsNewer ? "A newer" : "An older"); + text = prefixText + " beta release is available."; + } } else { text = "You're up to date."; } @@ -263,22 +289,36 @@ function UpdatePanel() { } this.statusDisplay.html(text); } + this.updateInfoDisplay = function() { - var html = 'Current version: ' + self.currentVersion + - ' (release notes). '; + var html = 'Current version: ' + self.currentVersion; + if (self.currentReleaseDate) html += '; released: ' + self.formatDate(self.currentReleaseDate); + html += ' (release notes).'; + if(self.canUpdate) { - html += 'Latest version: ' + self.newestVersion + - ' (release notes).'; + html += '
Latest version: ' + self.newestVersion; + if (self.newestReleaseDate) html += '; released: ' + self.formatDate(self.newestReleaseDate); + html += ' (release notes).'; } self.infoDisplay.html(html); } + this.setInAccessPointMode = function(inAccessPointMode) { _inAccessPointMode = inAccessPointMode; self.updateStatusDisplay(); } + this.formatDate = function(ts) { + if (!ts || ts.length != 8 || !/^[0-9]+$/.test(ts)) return null; + var fields = [ ts.substr(0, 4), ts.substr(4, 2), ts.substr(6, 2) ]; + if (!fields || fields.length != 3 || fields[1] > 12) return null; + + var abbrMonths = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Sep', 'Aug', 'Oct', 'Nov', 'Dec' ]; + return abbrMonths[fields[1] - 1] + " " + fields[2] + ", " + fields[0]; + } + this.versionIsBeta = function(version) { - return version.match(/.*-.*/g) != null; + return version ? /.*-.*/g.test(version) : null; } } diff --git a/www/settings.html b/www/settings.html index 147601e..b3418bd 100644 --- a/www/settings.html +++ b/www/settings.html @@ -166,7 +166,7 @@
Update
-
+


From 5c5d45088aacccf3d34b68129f67be7715211f9e Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 28 Feb 2014 23:57:00 +0100 Subject: [PATCH 05/12] Added mobile-web-app-capable meta tag and minimal-ui to viewport --- www/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/index.html b/www/index.html index cd3781b..dd3be8f 100644 --- a/www/index.html +++ b/www/index.html @@ -5,10 +5,13 @@ + + + - + From 2457ce656e02a632ecabe2d6687e6c9b8d7518d7 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 5 Mar 2014 13:49:15 +0100 Subject: [PATCH 06/12] Code formatting. --- js/Printer.js | 328 ++++++++++++++-------------- js/buttonbehaviors.js | 493 +++++++++++++++++++++--------------------- 2 files changed, 414 insertions(+), 407 deletions(-) diff --git a/js/Printer.js b/js/Printer.js index f5f3dc5..d0c1680 100644 --- a/js/Printer.js +++ b/js/Printer.js @@ -11,51 +11,51 @@ var $printProgressContainer = $("#printProgressContainer"); var $progressbar = $("#progressbar"); var $progressAmount = $(".progressAmount"); function setPrintprogress(val) { - if (isNaN(val)) return; -// console.log("f:setPrintprogress() >> val " + val); - $progressbar.css("width", val*100 + "%"); - $progressAmount.text(Math.floor(val*100) + "%"); + if (isNaN(val)) return; +// console.log("f:setPrintprogress() >> val " + val); + $progressbar.css("width", val*100 + "%"); + $progressAmount.text(Math.floor(val*100) + "%"); } //*/ 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 - Printer.IDLE_STATE = "idle"; // printer found, but idle - Printer.BUFFERING_STATE = "buffering"; // printer is buffering (recieving) data, but not yet printing - Printer.PRINTING_STATE = "printing"; - Printer.STOPPING_STATE = "stopping"; // when you stop (abort) a print it prints the endcode - Printer.TOUR_STATE = "tour"; // when in joyride mode + 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 + Printer.IDLE_STATE = "idle"; // printer found, but idle + Printer.BUFFERING_STATE = "buffering"; // printer is buffering (recieving) data, but not yet printing + Printer.PRINTING_STATE = "printing"; + Printer.STOPPING_STATE = "stopping"; // when you stop (abort) a print it prints the endcode + Printer.TOUR_STATE = "tour"; // when in joyride mode 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.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.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.checkStatusInterval = 3000; + this.checkStatusInterval = 3000; this.checkStatusDelay; - this.timeoutTime = 3000; - this.sendPrintPartTimeoutTime = 5000; + this.timeoutTime = 3000; + this.sendPrintPartTimeoutTime = 5000; - this.gcode; // gcode to be printed + this.gcode; // gcode to be printed this.sendLength = 500; // max amount of gcode lines per post (limited because WiFi box can't handle to much) - this.retryDelay = 2000; // retry setTimout delay - this.retrySendPrintPartDelay; // retry setTimout instance + this.retryDelay = 2000; // retry setTimout delay + this.retrySendPrintPartDelay; // retry setTimout instance this.retryCheckStatusDelay; // retry setTimout instance - this.retryStopDelay; // retry setTimout instance - this.retryPreheatDelay; // retry setTimout instance + this.retryStopDelay; // retry setTimout instance + this.retryPreheatDelay; // retry setTimout instance - Printer.MAX_GCODE_SIZE = 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; @@ -65,40 +65,40 @@ function Printer() { var self = this; this.init = function() { - //console.log("Printer:init"); + //console.log("Printer:init"); //this.wifiboxURL = "http://" + window.location.host + "/cgi-bin/d3dapi"; //this.wifiboxURL = "http://192.168.5.1/cgi-bin/d3dapi"; this.wifiboxURL = wifiboxURL; //this.wifiboxURL = "proxy5.php"; - //console.log(" wifiboxURL: ",this.wifiboxURL); + //console.log(" wifiboxURL: ",this.wifiboxURL); - if(autoUpdate) { - this.startStatusCheckInterval(); - } - } + if (autoUpdate) { + this.startStatusCheckInterval(); + } + } this.preheat = function() { - console.log("Printer:preheat"); + console.log("Printer:preheat"); - if( this.state == Printer.BUFFERING_STATE || - this.state == Printer.PRINTING_STATE || - this.state == Printer.STOPPING_STATE) { - return; - } + if( this.state == Printer.BUFFERING_STATE || + this.state == Printer.PRINTING_STATE || + this.state == Printer.STOPPING_STATE) { + return; + } - var self = this; - if (communicateWithWifibox) { - $.ajax({ - url: this.wifiboxURL + "/printer/heatup", - type: "POST", - dataType: 'json', - timeout: this.timeoutTime, - success: function(data){ - console.log("Printer:preheat response: ",data); - if(data.status != "success") { - clearTimeout(self.retryPreheatDelay); + var self = this; + if (communicateWithWifibox) { + $.ajax({ + url: this.wifiboxURL + "/printer/heatup", + type: "POST", + dataType: 'json', + timeout: this.timeoutTime, + success: function(data){ + console.log("Printer:preheat response: ",data); + if(data.status != "success") { + clearTimeout(self.retryPreheatDelay); self.retryPreheatDelay = setTimeout(function() { self.preheat() },self.retryDelay); // retry after delay - } + } } }).fail(function() { console.log("Printer:preheat: failed"); @@ -106,99 +106,101 @@ function Printer() { self.retryPreheatDelay = setTimeout(function() { self.preheat() },self.retryDelay); // retry after delay }); } else { - console.log ("Printer >> f:preheat() >> communicateWithWifibox is false, so not executing this function"); - } + 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); + console.log("Printer:print"); + console.log(" gcode total # of lines: " + gcode.length); - message.set("Sending doodle to printer...",Message.NOTICE); - self.addLeaveWarning(); + message.set("Sending doodle to printer...",Message.NOTICE); + self.addLeaveWarning(); - /*for (i = 0; i < gcode.length; i++) { + /*for (i = 0; i < gcode.length; i++) { gcode[i] += " (" + i + ")"; }*/ this.sendIndex = 0; - this.gcode = gcode; + 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); + //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 > Printer.MAX_GCODE_SIZE) { - alert("Error: Printer:print: gcode file is probably too big ("+gcodeSize+"MB) (max: "+Printer.MAX_GCODE_SIZE+"MB)"); - console.log("Error: Printer:print: gcode file is probably too big ("+gcodeSize+"MB) (max: "+Printer.MAX_GCODE_SIZE+"MB)"); + if(gcodeSize > Printer.MAX_GCODE_SIZE) { + alert("Error: Printer:print: gcode file is probably too big ("+gcodeSize+"MB) (max: "+Printer.MAX_GCODE_SIZE+"MB)"); + console.log("Error: Printer:print: gcode file is probably too big ("+gcodeSize+"MB) (max: "+Printer.MAX_GCODE_SIZE+"MB)"); - this.overruleState(Printer.IDLE_STATE); - this.startStatusCheckInterval(); - message.hide(); - self.removeLeaveWarning(); + this.overruleState(Printer.IDLE_STATE); + this.startStatusCheckInterval(); + message.hide(); + self.removeLeaveWarning(); - return; - } + return; + } - //this.targetTemperature = settings["printer.temperature"]; // slight hack + //this.targetTemperature = settings["printer.temperature"]; // slight hack this.sendPrintPart(this.sendIndex, this.sendLength); } + this.byteSize = function(s){ return~-encodeURI(s).split(/%..|./).length; } + this.sendPrintPart = function(sendIndex,sendLength) { console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength); - + var sendPercentage = Math.round(sendIndex/this.gcode.length*100); message.set("Sending doodle to printer: "+sendPercentage+"%",Message.NOTICE,false,true); - - 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)"); - sendLength = this.gcode.length - sendIndex; - //lastOne = true; - 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) { - $.ajax({ - url: this.wifiboxURL + "/printer/print", - type: "POST", - data: postData, - dataType: 'json', - timeout: this.sendPrintPartTimeoutTime, - success: function(data){ - console.log("Printer:sendPrintPart response: ",data); + var firstOne = (sendIndex == 0)? true : false; + var start = firstOne; // start printing right away - 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 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 + var completed = false; + if (this.gcode.length < (sendIndex + sendLength)) { + console.log(" sending less than max sendLength (and last)"); + sendLength = this.gcode.length - sendIndex; + //lastOne = true; + completed = true; + } + var gcodePart = this.gcode.slice(sendIndex, sendIndex+sendLength); - //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); - } - } - } - // after we know the first gcode packed has bin received or failed + var postData = { gcode: gcodePart.join("\n"), first: firstOne, start: start}; + var self = this; + if (communicateWithWifibox) { + $.ajax({ + url: this.wifiboxURL + "/printer/print", + type: "POST", + data: postData, + dataType: 'json', + 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 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,")"); + if(self.state == Printer.PRINTING_STATE || self.state == Printer.BUFFERING_STATE) { + //console.log("Printer:sendPrintPart:sending next part"); + self.sendPrintPart(sendIndex + sendLength, sendLength); + } + } + } + // after we know the first gcode packed has bin received or failed // (and the driver had time to update the printer.state) // we start checking the status again if(sendIndex == 0) { @@ -219,31 +221,31 @@ function Printer() { self.startStatusCheckInterval(); }); } else { - console.log ("Printer >> f:sendPrintPart() >> communicateWithWifibox is false, so not executing this function"); - } + console.log ("Printer >> f:sendPrintPart() >> communicateWithWifibox is false, so not executing this function"); + } } this.stop = function() { - console.log("Printer:stop"); - endCode = generateEndCode(); - console.log(" endCode: ",endCode); - var postData = { gcode: endCode.join("\n")}; + console.log("Printer:stop"); + endCode = generateEndCode(); + console.log(" endCode: ",endCode); + var postData = { gcode: endCode.join("\n")}; var self = this; if (communicateWithWifibox) { - $.ajax({ - url: this.wifiboxURL + "/printer/stop", - type: "POST", - data: postData, - dataType: 'json', - timeout: this.timeoutTime, - success: function(data){ - console.log("Printer:stop response: ", data); + $.ajax({ + url: this.wifiboxURL + "/printer/stop", + type: "POST", + data: postData, + dataType: 'json', + timeout: this.timeoutTime, + success: function(data){ + console.log("Printer:stop response: ", data); - // after we know the stop has bin received or failed + // after we know the stop has bin received or failed // (and the driver had time to update the printer.state) // we start checking the status again self.startStatusCheckInterval(); - } + } }).fail(function() { console.log("Printer:stop: failed"); clearTimeout(self.retryStopDelay); @@ -255,9 +257,10 @@ function Printer() { self.startStatusCheckInterval(); }); } else { - console.log ("Printer >> f:communicateWithWifibox() >> communicateWithWifibox is false, so not executing this function"); - } + console.log ("Printer >> f:communicateWithWifibox() >> communicateWithWifibox is false, so not executing this function"); + } } + this.startStatusCheckInterval = function() { console.log("Printer:startStatusCheckInterval"); self.checkStatus(); @@ -265,42 +268,45 @@ function Printer() { clearTimeout(self.retryCheckStatusDelay); self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval); } + this.stopStatusCheckInterval = function() { console.log("Printer:stopStatusCheckInterval"); clearTimeout(self.checkStatusDelay); clearTimeout(self.retryCheckStatusDelay); } + this.checkStatus = function() { //console.log("Printer:checkStatus"); this.stateOverruled = false; //console.log(" stateOverruled: ",this.stateOverruled); - var self = this; - if (communicateWithWifibox) { - $.ajax({ - url: this.wifiboxURL + "/info/status", - dataType: 'json', - timeout: this.timeoutTime, - success: function(response){ - //console.log(" Printer:status: ",response.data.state); //," response: ",response); + var self = this; + if (communicateWithWifibox) { + $.ajax({ + url: this.wifiboxURL + "/info/status", + dataType: 'json', + timeout: this.timeoutTime, + success: function(response){ + //console.log(" Printer:status: ",response.data.state); //," response: ",response); - self.handleStatusUpdate(response); + self.handleStatusUpdate(response); - clearTimeout(self.checkStatusDelay); - clearTimeout(self.retryCheckStatusDelay); - self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval); - } - }).fail(function() { - console.log("Printer:checkStatus: failed"); - self.state = Printer.WIFIBOX_DISCONNECTED_STATE; - clearTimeout(self.checkStatusDelay); - clearTimeout(self.retryCheckStatusDelay); - self.retryCheckStatusDelay = setTimeout(function() { self.checkStatus() },self.retryDelay); // retry after delay - $(document).trigger(Printer.UPDATE); - }); - } else { - console.log ("Printer >> f:checkStatus() >> communicateWithWifibox is false, so not executing this function"); - } + clearTimeout(self.checkStatusDelay); + clearTimeout(self.retryCheckStatusDelay); + self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval); + } + }).fail(function() { + console.log("Printer:checkStatus: failed"); + self.state = Printer.WIFIBOX_DISCONNECTED_STATE; + clearTimeout(self.checkStatusDelay); + clearTimeout(self.retryCheckStatusDelay); + self.retryCheckStatusDelay = setTimeout(function() { self.checkStatus() },self.retryDelay); // retry after delay + $(document).trigger(Printer.UPDATE); + }); + } else { + console.log ("Printer >> f:checkStatus() >> communicateWithWifibox is false, so not executing this function"); + } } + this.handleStatusUpdate = function(response) { //console.log("Printer:handleStatusUpdate response: ",response); var data = response.data; @@ -332,6 +338,7 @@ function Printer() { } $(document).trigger(Printer.UPDATE); } + this.overruleState = function(newState) { this.stateOverruled = true; console.log(" stateOverruled: ",this.stateOverruled); @@ -346,10 +353,11 @@ function Printer() { this.removeLeaveWarning = function() { window.onbeforeunload = null; } + this.addLeaveWarning = function() { window.onbeforeunload = function() { - console.log("WARNING:"+Printer.ON_BEFORE_UNLOAD_MESSAGE); - return Printer.ON_BEFORE_UNLOAD_MESSAGE; + console.log("WARNING:"+Printer.ON_BEFORE_UNLOAD_MESSAGE); + return Printer.ON_BEFORE_UNLOAD_MESSAGE; }; } } diff --git a/js/buttonbehaviors.js b/js/buttonbehaviors.js index a0df642..664b099 100644 --- a/js/buttonbehaviors.js +++ b/js/buttonbehaviors.js @@ -26,117 +26,118 @@ var preheatDelay; var preheatDelayTime = 15*1000; function initButtonBehavior() { - console.log("f:initButtonBehavior"); + console.log("f:initButtonBehavior"); - btnOops = new Button("#btnOops"); - btnInfo = new Button("#btnInfo"); - btnSettings = new Button("#btnSettings"); - btnNew = new Button("#btnNew"); - btnPrint= new Button("#btnPrint"); - btnStop = new Button("#btnStop"); - btnPrevious = new Button("#btnPrevious"); - btnNext = new Button("#btnNext"); - btnSave = new Button("#btnSave"); - buttonGroupAdd = $("#buttonGroupAdd"); + btnOops = new Button("#btnOops"); + btnInfo = new Button("#btnInfo"); + btnSettings = new Button("#btnSettings"); + btnNew = new Button("#btnNew"); + btnPrint= new Button("#btnPrint"); + btnStop = new Button("#btnStop"); + btnPrevious = new Button("#btnPrevious"); + btnNext = new Button("#btnNext"); + btnSave = new Button("#btnSave"); + buttonGroupAdd = $("#buttonGroupAdd"); btnShape = new Button("#btnShape"); btnWordArt = new Button("#btnWordArt"); popupWordArt = $("#popupWordArt"); popupShape = $("#popupShape"); popupMask = $("#popupMask"); logoPanel = $("#logopanel"); - btnToggleEdit = new Button("#btnToggleEdit"); - buttonGroupEdit = $("#buttonGroupEdit"); - btnZoom = new Button("#btnZoom"); - btnMove = new Button("#btnMove"); - btnRotate = new Button("#btnRotate"); - btnToggleVerticalShapes = new Button("#btnToggleVerticalShapes"); - buttonGroupVerticalShapes = $("#buttonGroupVerticalShapes"); - btnHeight = new Button("#btnHeight"); - btnTwist = new Button("#btnTwist"); - btnStraight = new Button("#btnStraight"); - btnDiv = new Button("#btnDiv"); - btnConv = new Button("#btnConv"); - btnSine = new Button("#btnSine"); - btnAdd = new Button("#btnAdd"); - - $(".btn").Button(); //initalize other buttons - - logoPanel.on("onButtonClick", onLogo); - btnNew.on("onButtonClick", onBtnNew); - btnAdd.on("onButtonClick", onBtnAdd); - btnWordArt.on("onButtonClick", onBtnWordArt); - btnShape.on("onButtonClick", onBtnShape); - btnPrint.on("onButtonClick", print); - btnStop.on("onButtonClick", stopPrint); - btnSave.on("onButtonClick", saveSketch); - btnPrevious.on("onButtonClick", prevDoodle); - btnNext.on("onButtonClick", nextDoodle); - btnOops.on("onButtonHold", onBtnOops); - // vertical shape buttons - btnToggleVerticalShapes.on("onButtonClick", onBtnToggleVerticalShapes); - btnHeight.on("onButtonHold", onBtnHeight); - btnTwist.on("onButtonHold", onBtnTwist); - btnStraight.on("onButtonClick", onBtnStraight); + btnToggleEdit = new Button("#btnToggleEdit"); + buttonGroupEdit = $("#buttonGroupEdit"); + btnZoom = new Button("#btnZoom"); + btnMove = new Button("#btnMove"); + btnRotate = new Button("#btnRotate"); + btnToggleVerticalShapes = new Button("#btnToggleVerticalShapes"); + buttonGroupVerticalShapes = $("#buttonGroupVerticalShapes"); + btnHeight = new Button("#btnHeight"); + btnTwist = new Button("#btnTwist"); + btnStraight = new Button("#btnStraight"); + btnDiv = new Button("#btnDiv"); + btnConv = new Button("#btnConv"); + btnSine = new Button("#btnSine"); + btnAdd = new Button("#btnAdd"); + + $(".btn").Button(); //initalize other buttons + + logoPanel.on("onButtonClick", onLogo); + btnNew.on("onButtonClick", onBtnNew); + btnAdd.on("onButtonClick", onBtnAdd); + btnWordArt.on("onButtonClick", onBtnWordArt); + btnShape.on("onButtonClick", onBtnShape); + btnPrint.on("onButtonClick", print); + btnStop.on("onButtonClick", stopPrint); + btnSave.on("onButtonClick", saveSketch); + btnPrevious.on("onButtonClick", prevDoodle); + btnNext.on("onButtonClick", nextDoodle); + btnOops.on("onButtonHold", onBtnOops); + // vertical shape buttons + btnToggleVerticalShapes.on("onButtonClick", onBtnToggleVerticalShapes); + btnHeight.on("onButtonHold", onBtnHeight); + btnTwist.on("onButtonHold", onBtnTwist); + btnStraight.on("onButtonClick", onBtnStraight); btnDiv.on("onButtonClick", onBtnDiv); btnConv.on("onButtonClick", onBtnConv); btnSine.on("onButtonClick", onBtnSine); - - btnToggleEdit.on("onButtonClick", onBtnToggleEdit); - btnMove.on("onButtonHold", onBtnMove); - btnZoom.on("onButtonHold", onBtnZoom); - btnRotate.on("onButtonHold", onBtnRotate); - - getSavedSketchStatus(); - setSketchModified(false); - function onBtnToggleVerticalShapes() { - var btnImg; - if(buttonGroupVerticalShapes.is(":hidden")) { - btnImg = "img/buttons/btnArrowClose.png"; - } else { - btnImg = "img/buttons/btnArrowOpen.png"; - } - btnToggleVerticalShapes.attr("src",btnImg); - - buttonGroupVerticalShapes.fadeToggle(BUTTON_GROUP_SHOW_DURATION); - } + btnToggleEdit.on("onButtonClick", onBtnToggleEdit); + btnMove.on("onButtonHold", onBtnMove); + btnZoom.on("onButtonHold", onBtnZoom); + btnRotate.on("onButtonHold", onBtnRotate); - function onLogo() { - location.reload(); + getSavedSketchStatus(); + setSketchModified(false); + + function onBtnToggleVerticalShapes() { + var btnImg; + if (buttonGroupVerticalShapes.is(":hidden")) { + btnImg = "img/buttons/btnArrowClose.png"; + } else { + btnImg = "img/buttons/btnArrowOpen.png"; + } + btnToggleVerticalShapes.attr("src",btnImg); + + buttonGroupVerticalShapes.fadeToggle(BUTTON_GROUP_SHOW_DURATION); } - function onBtnAdd() { - buttonGroupAdd.fadeToggle(BUTTON_GROUP_SHOW_DURATION); - } - function onBtnStraight() { - setVerticalShape(verticalShapes.NONE); - } - function onBtnDiv() { - setVerticalShape(verticalShapes.DIVERGING); - } - function onBtnConv() { - setVerticalShape(verticalShapes.CONVERGING); - } - function onBtnSine() { - setVerticalShape(verticalShapes.SINUS); - } + function onLogo() { + location.reload(); + } - function hitTest(cursor,button,radius) { - return distance(cursor.x,cursor.y,button.x,button.y)> sendPrintCommands = " + sendPrintCommands); - //if (!confirm("Weet je zeker dat je huidige print wilt stoppen?")) return; - if (sendPrintCommands) printer.stop(); - //setState(Printer.STOPPING_STATE,printer.hasControl); - printer.overruleState(Printer.STOPPING_STATE); + console.log("f:stopPrint() >> sendPrintCommands = " + sendPrintCommands); + //if (!confirm("Weet je zeker dat je huidige print wilt stoppen?")) return; + if (sendPrintCommands) printer.stop(); + //setState(Printer.STOPPING_STATE,printer.hasControl); + printer.overruleState(Printer.STOPPING_STATE); } function print(e) { console.log("f:print() >> sendPrintCommands = " + sendPrintCommands); - //$(".btnPrint").css("display","none"); + //$(".btnPrint").css("display","none"); - if (_points.length > 2) { + if (_points.length > 2) { - //setState(Printer.BUFFERING_STATE,printer.hasControl); - printer.overruleState(Printer.BUFFERING_STATE); + //setState(Printer.BUFFERING_STATE,printer.hasControl); + printer.overruleState(Printer.BUFFERING_STATE); - btnStop.css("display","none"); // hack + btnStop.css("display","none"); // hack - // 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() { + // 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() { - var gcode = generate_gcode(); - if (sendPrintCommands) { - if(gcode.length > 0) { - printer.print(gcode); - } else { - printer.overruleState(Printer.IDLE_STATE); - printer.startStatusCheckInterval(); - } + var gcode = generate_gcode(); + if (sendPrintCommands) { + if(gcode.length > 0) { + printer.print(gcode); + } else { + printer.overruleState(Printer.IDLE_STATE); + printer.startStatusCheckInterval(); + } } else { console.log("sendPrintCommands is false: not sending print command to 3dprinter"); } @@ -242,75 +243,75 @@ function print(e) { // $("#textdump").text(gcode.join("\n")); // } - }, gcodeGenerateDelay); - } else { - console.log("f:print >> not enough points!"); - } + }, gcodeGenerateDelay); + } else { + console.log("f:print >> not enough points!"); + } - //alert("Je tekening zal nu geprint worden"); - //$(".btnPrint").css("display","block"); + //alert("Je tekening zal nu geprint worden"); + //$(".btnPrint").css("display","block"); - // $.post("/doodle3d.of", { data:output }, function(data) { - // btnPrint.disabled = false; - // }); + // $.post("/doodle3d.of", { data:output }, function(data) { + // btnPrint.disabled = false; + // }); } function clearMainView() { - // console.log("f:clearMainView()"); - ctx.save(); - ctx.clearRect(0,0,canvas.width, canvas.height); - ctx.restore(); + // console.log("f:clearMainView()"); + ctx.save(); + ctx.clearRect(0,0,canvas.width, canvas.height); + ctx.restore(); } function resetPreview() { - // console.log("f:resetPreview()"); + // console.log("f:resetPreview()"); - // clear preview canvas - previewCtx.save(); - previewCtx.clearRect(0,0,canvas.width, canvas.height); - previewCtx.restore(); + // clear preview canvas + previewCtx.save(); + previewCtx.clearRect(0,0,canvas.width, canvas.height); + previewCtx.restore(); - // also make new Image, otherwise the previously cached preview can be redrawn with move up/down or twist left/right - doodleImageCapture = new Image(); + // also make new Image, otherwise the previously cached preview can be redrawn with move up/down or twist left/right + doodleImageCapture = new Image(); - // reset height and rotation to default values - numLayers = previewDefaults.numLayers; // current number of preview layers - rStep = previewDefaults.rotation; // Math.PI/180; //Math.PI/40; // + // reset height and rotation to default values + numLayers = previewDefaults.numLayers; // current number of preview layers + rStep = previewDefaults.rotation; // Math.PI/180; //Math.PI/40; // } function oopsUndo() { - // console.log("f:oopsUndo()"); - _points.pop(); + // console.log("f:oopsUndo()"); + _points.pop(); - if (clientInfo.isSmartphone) { - // do not recalc the whole preview's bounds during undo if client device is a smartphone - redrawDoodle(false); - } else { - // recalc the whole preview's bounds during if client device is not a smartphone - redrawDoodle(true); - } - redrawPreview(); + if (clientInfo.isSmartphone) { + // do not recalc the whole preview's bounds during undo if client device is a smartphone + redrawDoodle(false); + } else { + // recalc the whole preview's bounds during if client device is not a smartphone + redrawDoodle(true); + } + redrawPreview(); } function previewUp(redrawLess) { - // console.log("f:previewUp()"); - if (numLayers < maxNumLayers) { - numLayers++; - } - setSketchModified(true); + // console.log("f:previewUp()"); + if (numLayers < maxNumLayers) { + numLayers++; + } + setSketchModified(true); -// redrawPreview(redrawLess); - redrawRenderedPreview(redrawLess); +// redrawPreview(redrawLess); + redrawRenderedPreview(redrawLess); } function previewDown(redrawLess) { - // console.log("f:previewDown()"); - if (numLayers > minNumLayers) { - numLayers--; - } - setSketchModified(true); -// redrawPreview(redrawLess); - redrawRenderedPreview(redrawLess); + // console.log("f:previewDown()"); + if (numLayers > minNumLayers) { + numLayers--; + } + setSketchModified(true); +// redrawPreview(redrawLess); + redrawRenderedPreview(redrawLess); } function previewTwistLeft(redrawLess) { previewTwist(-twistIncrement,true) @@ -320,25 +321,23 @@ function previewTwistRight(redrawLess) { } function previewTwist(increment,redrawLess) { console.log("previewTwist: ",increment); - if (redrawLess == undefined) redrawLess = false; - - rStep += increment; - if(rStep < -previewRotationLimit) rStep = -previewRotationLimit; - else if(rStep > previewRotationLimit) rStep = previewRotationLimit; - - redrawRenderedPreview(redrawLess); - setSketchModified(true); + if (redrawLess == undefined) redrawLess = false; + + rStep += increment; + if(rStep < -previewRotationLimit) rStep = -previewRotationLimit; + else if(rStep > previewRotationLimit) rStep = previewRotationLimit; + + redrawRenderedPreview(redrawLess); + setSketchModified(true); } function resetTwist() { - rStep = 0; - redrawRenderedPreview(); - setSketchModified(true); + rStep = 0; + redrawRenderedPreview(); + setSketchModified(true); } function update() { - - setState(printer.state,printer.hasControl); thermometer.update(printer.temperature, printer.targetTemperature); @@ -371,54 +370,54 @@ function setState(newState,newHasControl) { // thermometer switch(newState) { - case Printer.IDLE_STATE: /* fall-through */ - case Printer.BUFFERING_STATE: /* fall-through */ - case Printer.PRINTING_STATE: /* fall-through */ - case Printer.STOPPING_STATE: - thermometer.show(); - break; - default: - thermometer.hide(); - break; + case Printer.IDLE_STATE: /* fall-through */ + case Printer.BUFFERING_STATE: /* fall-through */ + case Printer.PRINTING_STATE: /* fall-through */ + case Printer.STOPPING_STATE: + thermometer.show(); + break; + default: + thermometer.hide(); + break; } // progress indicator switch(newState) { - case Printer.PRINTING_STATE: - progressbar.show(); - break; - default: - progressbar.hide(); - break; + case Printer.PRINTING_STATE: + progressbar.show(); + break; + default: + progressbar.hide(); + break; } /* settings button */ switch(newState) { - case Printer.IDLE_STATE: - btnSettings.enable(); - break; - case Printer.WIFIBOX_DISCONNECTED_STATE: /* fall-through */ - case Printer.BUFFERING_STATE: /* fall-through */ - case Printer.PRINTING_STATE: /* fall-through */ - case Printer.STOPPING_STATE: - btnSettings.disable(); - break; - default: - btnSettings.enable(); - break; - } - + case Printer.IDLE_STATE: + btnSettings.enable(); + break; + case Printer.WIFIBOX_DISCONNECTED_STATE: /* fall-through */ + case Printer.BUFFERING_STATE: /* fall-through */ + case Printer.PRINTING_STATE: /* fall-through */ + case Printer.STOPPING_STATE: + btnSettings.disable(); + break; + default: + btnSettings.enable(); + break; + } + /* save, next and prev buttons */ switch(newState) { - case Printer.WIFIBOX_DISCONNECTED_STATE: - btnPrevious.disable(); - btnNext.disable() - btnSave.disable(); - break; - default: - updatePrevNextButtonState(); - if (isModified) btnSave.enable(); - break; + case Printer.WIFIBOX_DISCONNECTED_STATE: + btnPrevious.disable(); + btnNext.disable() + btnSave.disable(); + break; + default: + updatePrevNextButtonState(); + if (isModified) btnSave.enable(); + break; } if(newState == Printer.WIFIBOX_DISCONNECTED_STATE) { @@ -428,7 +427,7 @@ function setState(newState,newHasControl) { } else if(newState == Printer.DISCONNECTED_STATE) { message.set("Printer disconnected",Message.WARNING,true); } else if(prevState == Printer.DISCONNECTED_STATE && newState == Printer.IDLE_STATE || - prevState == Printer.UNKNOWN_STATE && newState == Printer.IDLE_STATE) { + prevState == Printer.UNKNOWN_STATE && newState == Printer.IDLE_STATE) { message.set("Printer connected",Message.INFO,true); console.log(" preheat: ",settings["printer.heatup.enabled"]); if(settings["printer.heatup.enabled"]) { From e050c8e080a58cc34f12bf9eef985ea5846cd6bc Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 5 Mar 2014 17:35:01 +0100 Subject: [PATCH 07/12] Add connecting state. --- js/Printer.js | 36 +++++++++++++++++------------------- js/buttonbehaviors.js | 13 ++++++------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/js/Printer.js b/js/Printer.js index d0c1680..ca0f556 100644 --- a/js/Printer.js +++ b/js/Printer.js @@ -23,13 +23,14 @@ 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 - Printer.IDLE_STATE = "idle"; // printer found, but idle + Printer.CONNECTING_STATE = "connecting"; // printer connecting (printer found, but driver has not yet finished setting up the connection) + Printer.IDLE_STATE = "idle"; // printer found and ready to use, but idle Printer.BUFFERING_STATE = "buffering"; // printer is buffering (recieving) data, but not yet printing Printer.PRINTING_STATE = "printing"; Printer.STOPPING_STATE = "stopping"; // when you stop (abort) a print it prints the endcode Printer.TOUR_STATE = "tour"; // when in joyride mode - Printer.ON_BEFORE_UNLOAD_MESSAGE = "You're doodle is still being send to the printer, leaving will result in a incomplete 3D print"; + Printer.ON_BEFORE_UNLOAD_MESSAGE = "You're doodle is still being sent to the printer, leaving will result in a incomplete 3D print"; this.temperature = 0; this.targetTemperature = 0; @@ -47,7 +48,7 @@ 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 to much) + 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 @@ -80,11 +81,7 @@ 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; - } + if (this.state != Printer.IDLE_STATE) return; var self = this; if (communicateWithWifibox) { @@ -131,8 +128,9 @@ function Printer() { console.log(" gcodeSize: ",gcodeSize); if(gcodeSize > Printer.MAX_GCODE_SIZE) { - alert("Error: Printer:print: gcode file is probably too big ("+gcodeSize+"MB) (max: "+Printer.MAX_GCODE_SIZE+"MB)"); - console.log("Error: Printer:print: gcode file is probably too big ("+gcodeSize+"MB) (max: "+Printer.MAX_GCODE_SIZE+"MB)"); + var msg = "Error: Printer:print: gcode file is probably too big ("+gcodeSize+"MB) (max: "+Printer.MAX_GCODE_SIZE+"MB)"; + alert(msg); + console.log(msg); this.overruleState(Printer.IDLE_STATE); this.startStatusCheckInterval(); @@ -191,7 +189,7 @@ function Printer() { 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 + // only if the state hasn't been changed (by for example pressing stop) we send more gcode //console.log("Printer:sendPrintPart:gcode part received (state: ",self.state,")"); if(self.state == Printer.PRINTING_STATE || self.state == Printer.BUFFERING_STATE) { @@ -257,7 +255,7 @@ function Printer() { self.startStatusCheckInterval(); }); } else { - console.log ("Printer >> f:communicateWithWifibox() >> communicateWithWifibox is false, so not executing this function"); + console.log ("Printer >> f:stop() >> communicateWithWifibox is false, so not executing this function"); } } @@ -316,21 +314,21 @@ function Printer() { // state //console.log(" stateOverruled: ",this.stateOverruled); if(!this.stateOverruled) { - self.state = data.state; + self.state = data.state; //console.log(" state > ",self.state); } // temperature - self.temperature = data.hotend; - self.targetTemperature = data.hotend_target; + self.temperature = data.hotend; + self.targetTemperature = data.hotend_target; // progress - self.currentLine = data.current_line; - self.totalLines = data.total_lines; - self.bufferedLines = data.buffered_lines + self.currentLine = data.current_line; + self.totalLines = data.total_lines; + self.bufferedLines = data.buffered_lines // access - self.hasControl = data.has_control; + 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+")"); diff --git a/js/buttonbehaviors.js b/js/buttonbehaviors.js index 664b099..c30a7c4 100644 --- a/js/buttonbehaviors.js +++ b/js/buttonbehaviors.js @@ -202,7 +202,6 @@ function initButtonBehavior() { function stopPrint() { console.log("f:stopPrint() >> sendPrintCommands = " + sendPrintCommands); - //if (!confirm("Weet je zeker dat je huidige print wilt stoppen?")) return; if (sendPrintCommands) printer.stop(); //setState(Printer.STOPPING_STATE,printer.hasControl); printer.overruleState(Printer.STOPPING_STATE); @@ -248,10 +247,6 @@ function print(e) { console.log("f:print >> not enough points!"); } - //alert("Je tekening zal nu geprint worden"); - //$(".btnPrint").css("display","block"); - - // $.post("/doodle3d.of", { data:output }, function(data) { // btnPrint.disabled = false; // }); @@ -393,6 +388,7 @@ function setState(newState,newHasControl) { /* settings button */ switch(newState) { + case Printer.CONNECTING_STATE: /* fall-through */ case Printer.IDLE_STATE: btnSettings.enable(); break; @@ -426,12 +422,15 @@ function setState(newState,newHasControl) { message.set("Connected to WiFi box",Message.INFO,true); } else if(newState == Printer.DISCONNECTED_STATE) { message.set("Printer disconnected",Message.WARNING,true); + } else if(newState == Printer.CONNECTING_STATE) { + message.set("Printer connecting",Message.INFO,false); } else if(prevState == Printer.DISCONNECTED_STATE && newState == Printer.IDLE_STATE || - prevState == Printer.UNKNOWN_STATE && newState == Printer.IDLE_STATE) { + prevState == Printer.UNKNOWN_STATE && newState == Printer.IDLE_STATE || + prevState == Printer.CONNECTING_STATE && newState == Printer.IDLE_STATE) { message.set("Printer connected",Message.INFO,true); console.log(" preheat: ",settings["printer.heatup.enabled"]); if(settings["printer.heatup.enabled"]) { - // HACK: we delay the preheat because the driver needs time to connect + // HACK: we delay the preheat because the makerbot driver needs time to connect clearTimeout(preheatDelay); preheatDelay = setTimeout(printer.preheat,preheatDelayTime); // retry after delay } From 2eaf21a03076a9f50991c39743648bdda933f17c Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 5 Mar 2014 22:46:43 +0100 Subject: [PATCH 08/12] Display hint about wrong printer type setting if connecting takes longer than 15 seconds. --- js/buttonbehaviors.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/js/buttonbehaviors.js b/js/buttonbehaviors.js index c30a7c4..bbb0532 100644 --- a/js/buttonbehaviors.js +++ b/js/buttonbehaviors.js @@ -21,10 +21,13 @@ var hasControl; var gcodeGenerateDelayer; var gcodeGenerateDelay = 50; - var preheatDelay; var preheatDelayTime = 15*1000; +var connectingHintDelay = null; +var connectingHintDelayTime = 15 * 1000; + + function initButtonBehavior() { console.log("f:initButtonBehavior"); @@ -416,6 +419,11 @@ function setState(newState,newHasControl) { break; } + if(connectingHintDelay && newState != Printer.CONNECTING_STATE) { + clearTimeout(connectingHintDelay); + connectingHintDelay = null; + } + if(newState == Printer.WIFIBOX_DISCONNECTED_STATE) { message.set("Lost connection to WiFi box",Message.ERROR); } else if(prevState == Printer.WIFIBOX_DISCONNECTED_STATE) { @@ -424,6 +432,13 @@ function setState(newState,newHasControl) { message.set("Printer disconnected",Message.WARNING,true); } else if(newState == Printer.CONNECTING_STATE) { message.set("Printer connecting",Message.INFO,false); + if (prevState != Printer.CONNECTING_STATE) { //enable 'watchdog' if we entered from a different state + clearTimeout(connectingHintDelay); + connectingHintDelay = setTimeout(function() { + message.set("Printer still not connected, did you select the correct type?", Message.WARNING, false); + connectingHintDelay = null; + }, connectingHintDelayTime); + } } else if(prevState == Printer.DISCONNECTED_STATE && newState == Printer.IDLE_STATE || prevState == Printer.UNKNOWN_STATE && newState == Printer.IDLE_STATE || prevState == Printer.CONNECTING_STATE && newState == Printer.IDLE_STATE) { From 71cbc779f29b8e1ebe668ffe57d3b9f5e01a100d Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Thu, 6 Mar 2014 11:16:08 +0100 Subject: [PATCH 09/12] Install redirect.html on box --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 75d8177..62c01a0 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,7 @@ define Package/doodle3d-client/install $(CP) $(PKG_BUILD_DIR)/www/index.html $(1)/www/ $(CP) $(PKG_BUILD_DIR)/www/settings.html $(1)/www/ $(CP) $(PKG_BUILD_DIR)/www/helpcontent.html $(1)/www/ + $(CP) $(PKG_BUILD_DIR)/www/redirect.html $(1)/www/ $(CP) $(PKG_BUILD_DIR)/www/css/debug.min.css $(1)/www/css/ $(CP) $(PKG_BUILD_DIR)/www/css/settings.min.css $(1)/www/css/ From ee6bab1c5a179c71b00c3a3f1a146826bf1c220c Mon Sep 17 00:00:00 2001 From: Wouter R Date: Thu, 6 Mar 2014 13:43:08 +0100 Subject: [PATCH 10/12] Change message.set() to set html instead of text. Move message div to appear on top of logo and dialog overlays. Minor text modifications. --- js/Message.js | 26 +++++++++++++------------- js/buttonbehaviors.js | 4 ++-- less/message.less | 3 ++- www/index.html | 24 ++++++++++++------------ 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/js/Message.js b/js/Message.js index cf061db..1856bf7 100644 --- a/js/Message.js +++ b/js/Message.js @@ -7,38 +7,38 @@ */ function Message() { - + Message.ERROR = "error"; Message.WARNING = "warning"; Message.NOTICE = "notice"; Message.INFO = "info"; - + this.mode = ""; - + this.$element; - + var self = this; var autoHideDelay = 5000; var autohideTimeout; - + this.init = function($element) { this.$element = $element; } - this.set = function(text,mode,autoHide,disableEffect) { - console.log("Message:set: ",text,mode,autoHide,disableEffect); + this.set = function(contents,mode,autoHide,disableEffect) { + console.log("Message:set: ",contents,mode,autoHide,disableEffect); if(disableEffect) { - self.fill(text,mode,autoHide) + self.fill(contents,mode,autoHide) } else{ self.hide(function() { self.show(); - self.fill(text,mode,autoHide) + self.fill(contents,mode,autoHide) }); } } - this.fill = function(text,mode,autoHide) { + this.fill = function(contents,mode,autoHide) { //console.log("Message:fill: ",text,mode,autoHide); self.clear(); - self.$element.text(text); + self.$element.html(contents); self.$element.addClass(mode); self.mode = mode; clearTimeout(autohideTimeout); @@ -47,10 +47,10 @@ function Message() { } } this.clear = function($element) { - this.$element.text(""); + this.$element.html(""); this.$element.removeClass(this.mode); } - + this.show = function() { this.$element.fadeIn(200); } diff --git a/js/buttonbehaviors.js b/js/buttonbehaviors.js index bbb0532..0b5541e 100644 --- a/js/buttonbehaviors.js +++ b/js/buttonbehaviors.js @@ -431,11 +431,11 @@ function setState(newState,newHasControl) { } else if(newState == Printer.DISCONNECTED_STATE) { message.set("Printer disconnected",Message.WARNING,true); } else if(newState == Printer.CONNECTING_STATE) { - message.set("Printer connecting",Message.INFO,false); + message.set("Printer connecting...",Message.INFO,false); if (prevState != Printer.CONNECTING_STATE) { //enable 'watchdog' if we entered from a different state clearTimeout(connectingHintDelay); connectingHintDelay = setTimeout(function() { - message.set("Printer still not connected, did you select the correct type?", Message.WARNING, false); + message.set("Printer still not connected, did you
select the correct printer type?", Message.WARNING, false); connectingHintDelay = null; }, connectingHintDelayTime); } diff --git a/less/message.less b/less/message.less index e66f1fa..c374aad 100644 --- a/less/message.less +++ b/less/message.less @@ -1,5 +1,6 @@ #message { position: absolute; + text-align: right; top: 0; right: 0; @@ -14,7 +15,7 @@ white-space:nowrap; //z-index: 5; - + display:none; &.error { diff --git a/www/index.html b/www/index.html index dd3be8f..cab8fab 100644 --- a/www/index.html +++ b/www/index.html @@ -7,11 +7,11 @@ - + - + @@ -39,7 +39,7 @@
- +
@@ -66,18 +66,16 @@ -
-
- +
- +
@@ -95,20 +93,20 @@
- +
- +
- +
- - + +
@@ -156,6 +154,8 @@
+ +
From 64d1c32f09a608645a2d6664789157a407947d2f Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 12 Mar 2014 16:30:37 +0100 Subject: [PATCH 11/12] Wait slightly longer before wrong printer type warning --- js/buttonbehaviors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/buttonbehaviors.js b/js/buttonbehaviors.js index 0b5541e..0d935a4 100644 --- a/js/buttonbehaviors.js +++ b/js/buttonbehaviors.js @@ -25,7 +25,7 @@ var preheatDelay; var preheatDelayTime = 15*1000; var connectingHintDelay = null; -var connectingHintDelayTime = 15 * 1000; +var connectingHintDelayTime = 20 * 1000; function initButtonBehavior() { From 0acf442a4648f393928b452cf9dbaabcf9d072b3 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 14 Mar 2014 12:23:57 +0100 Subject: [PATCH 12/12] Corrected updated status text --- js/settings/UpdatePanel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/settings/UpdatePanel.js b/js/settings/UpdatePanel.js index f1d9dcb..6afd3cc 100644 --- a/js/settings/UpdatePanel.js +++ b/js/settings/UpdatePanel.js @@ -273,8 +273,8 @@ function UpdatePanel() { text = "Installing update... (will take a minute)"; break; case UpdatePanel.INSTALLED: - text = "Update complete, please reconnect by connecting your device to the access point of your WiFi box and going to draw.doodle3d.com"; - //text = "Update complete, please refresh Page."; + //text = "Update complete, please reconnect by connecting your device to the access point of your WiFi box and going to draw.doodle3d.com"; + text = "Update complete, please refresh Page."; break; case UpdatePanel.INSTALL_FAILED: text = "Installing update failed.";