Compare commits

...

11 Commits

Author SHA1 Message Date
peteruithoven f8032d7411 Merge branch 'develop' 2017-06-23 12:36:16 +02:00
peteruithoven 2acb06c3ed Adding forgotten grunt task to make file: template
@companje This would add build info, create main.js.out which was used in later concat tasks. Without this task the final code would lack the main.js code.
2017-06-23 12:28:35 +02:00
peteruithoven daed62937c Merged master into develop 2016-07-26 15:24:38 +02:00
peteruithoven 058fff8b34 Handle multiple tags in buildinfo 2016-06-15 14:50:09 +02:00
peteruithoven 28808078ad Enable using common npm start script 2016-06-15 14:49:46 +02:00
peteruithoven 4e18fa0f56 Execute new gitinfo in OpenWRT build 2016-05-11 13:28:44 +02:00
peteruithoven 225a173da7 Altered Build/Compile to run from shared folder
so grunt can access git info
2016-05-11 13:28:15 +02:00
peteruithoven d2bc62b092 Fix stopping while sending
Fixes https://github.com/Doodle3D/WiFi-Box/issues/9
2016-05-11 12:22:54 +02:00
peteruithoven 28ce8ff479 OpenWRT Build/Prepare fix
Copy js files to build dir so grunt can use them
Relevant for #307
2016-05-10 16:06:27 +02:00
peteruithoven fbcdaad54a Fix OpenWRT makefile Build/Compile step
Fixes #307
2016-05-10 15:21:49 +02:00
Wouter R 4a3da30ebd Log git/version information in web console (#305).
The information is dynamically inserted when grunt is run.
2016-04-23 17:36:35 +02:00
7 changed files with 65 additions and 18 deletions

9
.gitignore vendored
View File

@ -18,18 +18,11 @@ img/logo/logo_smaller.png
img/logo/logo_smaller_8bit.png
img/logo/logo_smaller_wide_8bit.png
img/logo/logo_smallest.png
css/_backup20131010/*
css/_backup20131011/*
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/previewRendering_v02.js.orig
less/verticalshapes.css
less/verticalshapes_backup.css
__settings.html
css/_settings.css
node_modules/*
js/main.js.out

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
included=//*.js

View File

@ -10,6 +10,32 @@ module.exports = function(grunt) {
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' 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: {
options: {
// separator: ';'
@ -22,7 +48,8 @@ module.exports = function(grunt) {
'js/*.js',
// make sure we put main.js last
'!js/main.js',
'js/main.js', ],
'js/main.js.out'
],
dest: 'www/js/<%= pkg.name %>.js'
}
},
@ -129,6 +156,8 @@ module.exports = function(grunt) {
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-gitinfo');
grunt.loadNpmTasks('grunt-template');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
@ -139,6 +168,8 @@ module.exports = function(grunt) {
// Default task.
grunt.registerTask('default', [
'gitinfo',
'template',
'less',
'autoprefixer',
'cssmin',

View File

@ -34,6 +34,7 @@ endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) js $(PKG_BUILD_DIR)/
$(CP) less $(PKG_BUILD_DIR)/
$(CP) www $(PKG_BUILD_DIR)/
$(CP) Gruntfile.js $(PKG_BUILD_DIR)/
@ -43,12 +44,16 @@ define Build/Prepare
endef
define Build/Compile
# We're running grunt in the shared folder, so
# grunt can access git info
npm install
ifeq ($(CONFIG_DOODLE3D_CLIENT_MINIFY_JS),y)
grunt less autoprefixer cssmin concat uglify
grunt gitinfo template less autoprefixer cssmin concat uglify
else
grunt less autoprefixer cssmin concat
grunt gitinfo template less autoprefixer cssmin concat
endif
# Copy compiled files to build dir
$(CP) www $(PKG_BUILD_DIR)/
endef
define Package/doodle3d-client/install

View File

@ -168,6 +168,11 @@ function Printer() {
}
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;
if (this.gcode.length < (sendIndex + sendLength)) {
sendLength = this.gcode.length - sendIndex;
@ -200,8 +205,6 @@ function Printer() {
/* send data */
var self = this;
if (communicateWithWifibox) {
$.ajax({
url: this.wifiboxURL + "/printer/print",
@ -296,7 +299,7 @@ function Printer() {
console.log("Printer:waitForBufferSpace: waiting until gcode buffer load ratio is below " +
(Printer.GCODE_BUFFER_WAIT_LOAD_RATIO * 100) + "% (current: " + fillPercent + "% of " +
(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 {
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...");
@ -309,10 +312,17 @@ function Printer() {
this.stop = function() {
console.log("Printer:stop");
var self = this;
if (self.retrySendPrintPartDelay !== undefined) {
clearTimeout(self.retrySendPrintPartDelay);
}
if (self.waitForBufferSpaceDelay !== undefined) {
clearTimeout(self.waitForBufferSpaceDelay);
}
endCode = generateEndCode();
console.log(" endCode: ",endCode);
var postData = { gcode: endCode.join("\n")};
var self = this;
if (communicateWithWifibox) {
$.ajax({
url: this.wifiboxURL + "/printer/stop",

View File

@ -34,7 +34,8 @@ var POPUP_SHOW_DURATION = 175;
var BUTTON_GROUP_SHOW_DURATION = 80;
$(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("p") != "null") sendPrintCommands = (getURLParameter("p") == "1");

View File

@ -9,7 +9,7 @@
"author": "Peter Uithoven, Adriaan Wormgoor, Rick Companje, Wouter Reckman",
"readmeFilename": "README.md",
"devDependencies": {
"grunt": "~0.4.1",
"grunt": "~0.4.5",
"grunt-cli": "~0.1.9",
"grunt-contrib-less": "~0.7.0",
"grunt-contrib-watch": "~0.5.3",
@ -17,6 +17,11 @@
"grunt-contrib-jshint": "~0.6.4",
"grunt-autoprefixer": "~0.4.0",
"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"
}
}