mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-09-28 22:18:38 +02:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f8032d7411 | ||
|
2acb06c3ed | ||
|
daed62937c | ||
|
058fff8b34 | ||
|
28808078ad | ||
|
4e18fa0f56 | ||
|
225a173da7 | ||
|
d2bc62b092 | ||
|
28ce8ff479 | ||
|
fbcdaad54a | ||
|
4a3da30ebd | ||
|
533968bb04 | ||
|
0a9ceee49a | ||
|
50d964e611 | ||
|
656e37670e |
9
.gitignore
vendored
9
.gitignore
vendored
@ -18,18 +18,11 @@ img/logo/logo_smaller.png
|
|||||||
img/logo/logo_smaller_8bit.png
|
img/logo/logo_smaller_8bit.png
|
||||||
img/logo/logo_smaller_wide_8bit.png
|
img/logo/logo_smaller_wide_8bit.png
|
||||||
img/logo/logo_smallest.png
|
img/logo/logo_smallest.png
|
||||||
css/_backup20131010/*
|
|
||||||
css/_backup20131011/*
|
|
||||||
d3d_btns.css
|
d3d_btns.css
|
||||||
index.html.orig
|
|
||||||
js/Thermometer.js.orig
|
|
||||||
js/buttonbehaviors.js.orig
|
|
||||||
js/gcodeGenerating_v01.js.orig
|
|
||||||
js/init_layout backup20130918.js
|
|
||||||
js/main.js.orig
|
js/main.js.orig
|
||||||
js/previewRendering_v02.js.orig
|
|
||||||
less/verticalshapes.css
|
less/verticalshapes.css
|
||||||
less/verticalshapes_backup.css
|
less/verticalshapes_backup.css
|
||||||
__settings.html
|
__settings.html
|
||||||
css/_settings.css
|
css/_settings.css
|
||||||
node_modules/*
|
node_modules/*
|
||||||
|
js/main.js.out
|
||||||
|
2
.settings/com.eclipsesource.jshint.ui.prefs
Normal file
2
.settings/com.eclipsesource.jshint.ui.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
included=//*.js
|
33
Gruntfile.js
33
Gruntfile.js
@ -10,6 +10,32 @@ module.exports = function(grunt) {
|
|||||||
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
||||||
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
||||||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
|
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
|
||||||
|
gitinfo: {
|
||||||
|
options: {},
|
||||||
|
commands: { 'tag': ['tag', '--points-at', 'HEAD'] }
|
||||||
|
},
|
||||||
|
template: {
|
||||||
|
'add_build_info': {
|
||||||
|
options: {
|
||||||
|
data: function() {
|
||||||
|
grunt.task.requires('gitinfo');
|
||||||
|
var gi = grunt.config('gitinfo');
|
||||||
|
var lbc = gi.local.branch.current;
|
||||||
|
|
||||||
|
var tags = (gi.tag == '') ? 'no_tag' : gi.tag;
|
||||||
|
tags = tags.split('\n').join(',');
|
||||||
|
var commitMsg = lbc.lastCommitMessage.slice(1, -1).split('\n')[0].replace(/"/g, '\\\"');
|
||||||
|
|
||||||
|
var buildInfo = lbc.shortSHA + "/" + lbc.name + "/" + tags +
|
||||||
|
" (" + lbc.lastCommitTime.slice(1, -1) + "; \'" + commitMsg + "'";
|
||||||
|
return { 'build_info': buildInfo };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
files: {
|
||||||
|
'js/main.js.out': ['js/main.js']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
concat: {
|
concat: {
|
||||||
options: {
|
options: {
|
||||||
// separator: ';'
|
// separator: ';'
|
||||||
@ -22,7 +48,8 @@ module.exports = function(grunt) {
|
|||||||
'js/*.js',
|
'js/*.js',
|
||||||
// make sure we put main.js last
|
// make sure we put main.js last
|
||||||
'!js/main.js',
|
'!js/main.js',
|
||||||
'js/main.js', ],
|
'js/main.js.out'
|
||||||
|
],
|
||||||
dest: 'www/js/<%= pkg.name %>.js'
|
dest: 'www/js/<%= pkg.name %>.js'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -129,6 +156,8 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// These plugins provide necessary tasks.
|
// These plugins provide necessary tasks.
|
||||||
|
grunt.loadNpmTasks('grunt-gitinfo');
|
||||||
|
grunt.loadNpmTasks('grunt-template');
|
||||||
grunt.loadNpmTasks('grunt-contrib-less');
|
grunt.loadNpmTasks('grunt-contrib-less');
|
||||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
@ -139,6 +168,8 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
// Default task.
|
// Default task.
|
||||||
grunt.registerTask('default', [
|
grunt.registerTask('default', [
|
||||||
|
'gitinfo',
|
||||||
|
'template',
|
||||||
'less',
|
'less',
|
||||||
'autoprefixer',
|
'autoprefixer',
|
||||||
'cssmin',
|
'cssmin',
|
||||||
|
9
Makefile
9
Makefile
@ -34,6 +34,7 @@ endef
|
|||||||
|
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
mkdir -p $(PKG_BUILD_DIR)
|
mkdir -p $(PKG_BUILD_DIR)
|
||||||
|
$(CP) js $(PKG_BUILD_DIR)/
|
||||||
$(CP) less $(PKG_BUILD_DIR)/
|
$(CP) less $(PKG_BUILD_DIR)/
|
||||||
$(CP) www $(PKG_BUILD_DIR)/
|
$(CP) www $(PKG_BUILD_DIR)/
|
||||||
$(CP) Gruntfile.js $(PKG_BUILD_DIR)/
|
$(CP) Gruntfile.js $(PKG_BUILD_DIR)/
|
||||||
@ -43,12 +44,16 @@ define Build/Prepare
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Compile
|
define Build/Compile
|
||||||
|
# We're running grunt in the shared folder, so
|
||||||
|
# grunt can access git info
|
||||||
npm install
|
npm install
|
||||||
ifeq ($(CONFIG_DOODLE3D_CLIENT_MINIFY_JS),y)
|
ifeq ($(CONFIG_DOODLE3D_CLIENT_MINIFY_JS),y)
|
||||||
grunt less autoprefixer cssmin concat uglify
|
grunt gitinfo template less autoprefixer cssmin concat uglify
|
||||||
else
|
else
|
||||||
grunt less autoprefixer cssmin concat
|
grunt gitinfo template less autoprefixer cssmin concat
|
||||||
endif
|
endif
|
||||||
|
# Copy compiled files to build dir
|
||||||
|
$(CP) www $(PKG_BUILD_DIR)/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/doodle3d-client/install
|
define Package/doodle3d-client/install
|
||||||
|
@ -37,6 +37,9 @@ function Printer() {
|
|||||||
Printer.GCODE_BUFFER_WAIT_LOAD_RATIO = 0.75;
|
Printer.GCODE_BUFFER_WAIT_LOAD_RATIO = 0.75;
|
||||||
Printer.BUFFER_SPACE_WAIT_TIMEOUT = 30000; // how often to recheck buffer load
|
Printer.BUFFER_SPACE_WAIT_TIMEOUT = 30000; // how often to recheck buffer load
|
||||||
|
|
||||||
|
//time to wait when wifibox connection is lost while printing
|
||||||
|
Printer.DISCONNECTED_RETRY_DELAY = 5000;
|
||||||
|
|
||||||
Printer.MAX_LINES_PER_POST = 500; // max amount of gcode lines per post (limited because WiFi box can't handle too much)
|
Printer.MAX_LINES_PER_POST = 500; // max amount of gcode lines per post (limited because WiFi box can't handle too much)
|
||||||
Printer.MAX_GCODE_SIZE = 10; // max size of gcode in MB's (estimation)
|
Printer.MAX_GCODE_SIZE = 10; // max size of gcode in MB's (estimation)
|
||||||
|
|
||||||
@ -165,6 +168,11 @@ function Printer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.sendPrintPart = function(sendIndex,sendLength) {
|
this.sendPrintPart = function(sendIndex,sendLength) {
|
||||||
|
var self = this;
|
||||||
|
// Abort if stopping
|
||||||
|
// sendPrintPart can be called by delayed retry after request timeout for example
|
||||||
|
if (self.state === Printer.STOPPING_STATE) return;
|
||||||
|
|
||||||
var completed = false;
|
var completed = false;
|
||||||
if (this.gcode.length < (sendIndex + sendLength)) {
|
if (this.gcode.length < (sendIndex + sendLength)) {
|
||||||
sendLength = this.gcode.length - sendIndex;
|
sendLength = this.gcode.length - sendIndex;
|
||||||
@ -197,8 +205,6 @@ function Printer() {
|
|||||||
|
|
||||||
|
|
||||||
/* send data */
|
/* send data */
|
||||||
|
|
||||||
var self = this;
|
|
||||||
if (communicateWithWifibox) {
|
if (communicateWithWifibox) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: this.wifiboxURL + "/printer/print",
|
url: this.wifiboxURL + "/printer/print",
|
||||||
@ -207,7 +213,7 @@ function Printer() {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
timeout: this.sendPrintPartTimeoutTime,
|
timeout: this.sendPrintPartTimeoutTime,
|
||||||
success: function(data){
|
success: function(data){
|
||||||
//console.log("Printer:sendPrintPart response: ",data);
|
//console.log("Printer:sendPrintPart success response: ", data);
|
||||||
|
|
||||||
if(data.status == "success") {
|
if(data.status == "success") {
|
||||||
if (completed) {
|
if (completed) {
|
||||||
@ -224,16 +230,26 @@ function Printer() {
|
|||||||
if(self.state == Printer.PRINTING_STATE || self.state == Printer.BUFFERING_STATE) {
|
if(self.state == Printer.PRINTING_STATE || self.state == Printer.BUFFERING_STATE) {
|
||||||
//console.log("Printer:sendPrintPart:sending next part");
|
//console.log("Printer:sendPrintPart:sending next part");
|
||||||
self.sendPrintPart(sendIndex + sendLength, sendLength);
|
self.sendPrintPart(sendIndex + sendLength, sendLength);
|
||||||
|
} else if (Printer.WIFIBOX_DISCONNECTED_STATE) {
|
||||||
|
console.warn("Printer:sendPrintPart: wifibox connection lost while printing, retrying in " + (Printer.DISCONNECTED_RETRY_DELAY / 1000) + " seconds");
|
||||||
|
clearTimeout(self.retrySendPrintPartDelay);
|
||||||
|
self.retrySendPrintPartDelay = setTimeout(function() {
|
||||||
|
console.log("Printer:sendPrintPart: retrying after wifibox disconnect was detected");
|
||||||
|
self.sendPrintPart(sendIndex, sendLength);
|
||||||
|
}, Printer.DISCONNECTED_RETRY_DELAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (data.status == "fail") {
|
} else if (data.status == "fail") {
|
||||||
if (data.data.status == "buffer_full") {
|
if (data.data.status == "buffer_full") {
|
||||||
|
console.log("Printer:sendPrintPart: print server reported buffer full, pausing data transmission");
|
||||||
//this will wait in a setTimeout loop until enough room is available and then call sendPrintPart again.
|
//this will wait in a setTimeout loop until enough room is available and then call sendPrintPart again.
|
||||||
self.waitForBufferSpace(sendIndex, sendLength);
|
self.waitForBufferSpace(sendIndex, sendLength);
|
||||||
|
} else if (data.data.status == "seq_num_mismatch" && data.data.seq_number == seqNum) {
|
||||||
|
console.warn("Printer:sendPrintPart: received sequence error, server is one chunk ahead. Proceeding with next chunk...");
|
||||||
|
self.sendPrintPart(sendIndex + sendLength, sendLength);
|
||||||
} else {
|
} else {
|
||||||
//Note: apart from logging an error here, we ignore these errors as they all have to do
|
console.error("Printer:sendPrintPart: unexpected failure response for API endpoint printer/print (" +
|
||||||
//with chunk sequencing, which we do not use, except for the source parameter which is set internally.
|
data.data.status + ", current server seq. info: " + data.data.seq_number + "/" + data.data.seq_total + ")");
|
||||||
console.error("Printer:sendPrintPart: unexpected failure response for API endpoint printer/print (" + data.data.status + ")");
|
|
||||||
//sequence errors should not occur, except perhaps when 'stop' was clicked while still sending (https://github.com/Doodle3D/doodle3d-client/issues/226).
|
//sequence errors should not occur, except perhaps when 'stop' was clicked while still sending (https://github.com/Doodle3D/doodle3d-client/issues/226).
|
||||||
if (self.state != Printer.STOPPING_STATE) {
|
if (self.state != Printer.STOPPING_STATE) {
|
||||||
message.set("Unexpected error sending doodle to printer (" + data.data.status + "), please retry", Message.ERROR, false, true);
|
message.set("Unexpected error sending doodle to printer (" + data.data.status + "), please retry", Message.ERROR, false, true);
|
||||||
@ -248,13 +264,14 @@ function Printer() {
|
|||||||
self.startStatusCheckInterval();
|
self.startStatusCheckInterval();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).fail(function() {
|
}).fail(function(jqXHr, textStatus, errorThrown) {
|
||||||
console.log("Printer:sendPrintPart: failed");
|
console.error("Printer:sendPrintPart: failed (AJAX status: '" + textStatus + "') AJAX exception (if any):", errorThrown);
|
||||||
|
console.warn("Printer:sendPrintPart: retrying in " + (Printer.DISCONNECTED_RETRY_DELAY / 1000) + " seconds");
|
||||||
clearTimeout(self.retrySendPrintPartDelay);
|
clearTimeout(self.retrySendPrintPartDelay);
|
||||||
self.retrySendPrintPartDelay = setTimeout(function() {
|
self.retrySendPrintPartDelay = setTimeout(function() {
|
||||||
console.log("request printer:sendPrintPart failed retry");
|
console.log("Printer:sendPrintPart: retrying after AJAX failure");
|
||||||
self.sendPrintPart(sendIndex, sendLength)
|
self.sendPrintPart(sendIndex, sendLength)
|
||||||
},self.retryDelay); // retry after delay
|
}, Printer.DISCONNECTED_RETRY_DELAY);
|
||||||
|
|
||||||
// after we know the gcode packed has bin received or failed
|
// 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)
|
||||||
@ -282,7 +299,7 @@ function Printer() {
|
|||||||
console.log("Printer:waitForBufferSpace: waiting until gcode buffer load ratio is below " +
|
console.log("Printer:waitForBufferSpace: waiting until gcode buffer load ratio is below " +
|
||||||
(Printer.GCODE_BUFFER_WAIT_LOAD_RATIO * 100) + "% (current: " + fillPercent + "% of " +
|
(Printer.GCODE_BUFFER_WAIT_LOAD_RATIO * 100) + "% (current: " + fillPercent + "% of " +
|
||||||
(self.maxBufferSize / 1024) + "KiB)");
|
(self.maxBufferSize / 1024) + "KiB)");
|
||||||
setTimeout(function() { self.waitForBufferSpace(sendIndex, sendLength); }, Printer.BUFFER_SPACE_WAIT_TIMEOUT);
|
self.waitForBufferSpaceDelay = setTimeout(function() { self.waitForBufferSpace(sendIndex, sendLength); }, Printer.BUFFER_SPACE_WAIT_TIMEOUT);
|
||||||
} else {
|
} else {
|
||||||
if(self.state == Printer.PRINTING_STATE || self.state == Printer.BUFFERING_STATE) {
|
if(self.state == Printer.PRINTING_STATE || self.state == Printer.BUFFERING_STATE) {
|
||||||
console.log("Printer:waitForBufferSpace: load ratio dropped below " + (Printer.GCODE_BUFFER_WAIT_LOAD_RATIO * 100) + "%, calling sendPrintPart...");
|
console.log("Printer:waitForBufferSpace: load ratio dropped below " + (Printer.GCODE_BUFFER_WAIT_LOAD_RATIO * 100) + "%, calling sendPrintPart...");
|
||||||
@ -295,10 +312,17 @@ function Printer() {
|
|||||||
|
|
||||||
this.stop = function() {
|
this.stop = function() {
|
||||||
console.log("Printer:stop");
|
console.log("Printer:stop");
|
||||||
|
var self = this;
|
||||||
|
if (self.retrySendPrintPartDelay !== undefined) {
|
||||||
|
clearTimeout(self.retrySendPrintPartDelay);
|
||||||
|
}
|
||||||
|
if (self.waitForBufferSpaceDelay !== undefined) {
|
||||||
|
clearTimeout(self.waitForBufferSpaceDelay);
|
||||||
|
}
|
||||||
|
|
||||||
endCode = generateEndCode();
|
endCode = generateEndCode();
|
||||||
console.log(" endCode: ",endCode);
|
console.log(" endCode: ",endCode);
|
||||||
var postData = { gcode: endCode.join("\n")};
|
var postData = { gcode: endCode.join("\n")};
|
||||||
var self = this;
|
|
||||||
if (communicateWithWifibox) {
|
if (communicateWithWifibox) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: this.wifiboxURL + "/printer/stop",
|
url: this.wifiboxURL + "/printer/stop",
|
||||||
|
@ -356,7 +356,7 @@ function setState(newState,newHasControl) {
|
|||||||
|
|
||||||
prevState = state;
|
prevState = state;
|
||||||
|
|
||||||
console.log("setState: ",prevState," > ",newState," ( ",newHasControl,")");
|
console.log("setState: " + prevState + " > " + newState + " ( " + newHasControl + ")");
|
||||||
setDebugText("State: "+newState);
|
setDebugText("State: "+newState);
|
||||||
|
|
||||||
// print button
|
// print button
|
||||||
|
@ -34,7 +34,8 @@ var POPUP_SHOW_DURATION = 175;
|
|||||||
var BUTTON_GROUP_SHOW_DURATION = 80;
|
var BUTTON_GROUP_SHOW_DURATION = 80;
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
console.log("ready");
|
console.log("Doodle3D client ready");
|
||||||
|
console.log("Build information - <%= build_info %>)");
|
||||||
|
|
||||||
if (getURLParameter("d") != "null") debugMode = (getURLParameter("d") == "1");
|
if (getURLParameter("d") != "null") debugMode = (getURLParameter("d") == "1");
|
||||||
if (getURLParameter("p") != "null") sendPrintCommands = (getURLParameter("p") == "1");
|
if (getURLParameter("p") != "null") sendPrintCommands = (getURLParameter("p") == "1");
|
||||||
|
@ -204,7 +204,7 @@ function UpdatePanel() {
|
|||||||
this.setState = function(newState,refresh) {
|
this.setState = function(newState,refresh) {
|
||||||
//console.log("UpdatePanel:setState");
|
//console.log("UpdatePanel:setState");
|
||||||
if(!refresh && this.state == newState) return;
|
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,")");
|
console.log("UpdatePanel:setState: " + this.state + " > " + newState + "(" + this.stateText + ") (in Access Point Mode: " + _inAccessPointMode + ") (newestVersion: " + self.newestVersion + ") (refresh: " + refresh + ")");
|
||||||
this.state = newState;
|
this.state = newState;
|
||||||
|
|
||||||
// should personal sketches and settings be retained over update?
|
// should personal sketches and settings be retained over update?
|
||||||
|
@ -41,7 +41,7 @@ function setSketchModified(_isModified) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateSketchButtonStates() {
|
function updateSketchButtonStates() {
|
||||||
console.log('sketch: isModified',isModified,'curSketch',curSketch,'sketches.length',sketches.length);
|
console.log('sketch: isModified: ' + isModified + ', curSketch: ' + curSketch + ', sketches.length: ' + sketches.length);
|
||||||
|
|
||||||
if (isModified) {
|
if (isModified) {
|
||||||
btnSave.enable();
|
btnSave.enable();
|
||||||
@ -72,7 +72,7 @@ function loadSketch(_curSketch) {
|
|||||||
|
|
||||||
var id = sketches[curSketch];
|
var id = sketches[curSketch];
|
||||||
|
|
||||||
console.log('sketch: loadSketch curSketch',curSketch,'id',id);
|
console.log('sketch: loadSketch curSketch:' + curSketch + ', id: ' + id);
|
||||||
|
|
||||||
$.get(wifiboxURL + "/sketch", {id:id}, function(response) {
|
$.get(wifiboxURL + "/sketch", {id:id}, function(response) {
|
||||||
if (response.status=='success') {
|
if (response.status=='success') {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"author": "Peter Uithoven, Adriaan Wormgoor, Rick Companje, Wouter Reckman",
|
"author": "Peter Uithoven, Adriaan Wormgoor, Rick Companje, Wouter Reckman",
|
||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~0.4.1",
|
"grunt": "~0.4.5",
|
||||||
"grunt-cli": "~0.1.9",
|
"grunt-cli": "~0.1.9",
|
||||||
"grunt-contrib-less": "~0.7.0",
|
"grunt-contrib-less": "~0.7.0",
|
||||||
"grunt-contrib-watch": "~0.5.3",
|
"grunt-contrib-watch": "~0.5.3",
|
||||||
@ -17,6 +17,11 @@
|
|||||||
"grunt-contrib-jshint": "~0.6.4",
|
"grunt-contrib-jshint": "~0.6.4",
|
||||||
"grunt-autoprefixer": "~0.4.0",
|
"grunt-autoprefixer": "~0.4.0",
|
||||||
"grunt-contrib-cssmin": "~0.6.2",
|
"grunt-contrib-cssmin": "~0.6.2",
|
||||||
"grunt-contrib-concat": "~0.3.0"
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
|
"grunt-gitinfo": "~0.1.7",
|
||||||
|
"grunt-template": "~0.2.3"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "grunt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user