Merge branch 'master' of github.com:GridSpace/apps

This commit is contained in:
Stewart Allen 2018-01-07 11:16:22 -05:00
commit 6f2661cf73
3 changed files with 67 additions and 9 deletions

View file

@ -36,6 +36,8 @@ self.kiri.license = exports.LICENSE;
nozzleSize: 1, nozzleSize: 1,
gcodePre: 1, gcodePre: 1,
gcodePost: 1, gcodePost: 1,
gcodeProc: 1,
gcodeFExt: 1,
gcodeFan: 1, gcodeFan: 1,
gcodeTrack: 1, gcodeTrack: 1,
gcodeLayer: 1 gcodeLayer: 1
@ -226,6 +228,7 @@ self.kiri.license = exports.LICENSE;
spindleMax: 0, // CAM spindleMax: 0, // CAM
gcodePre: [], // FDM/CAM header script gcodePre: [], // FDM/CAM header script
gcodePost: [], // FDM/CAM footer script gcodePost: [], // FDM/CAM footer script
gcodeProc: "", // FDM post processor script
gcodeFan: "", // FDM fan command gcodeFan: "", // FDM fan command
gcodeTrack: "", // FDM progress command gcodeTrack: "", // FDM progress command
gcodeLayer: "", // FDM layer output gcodeLayer: "", // FDM layer output
@ -952,12 +955,18 @@ self.kiri.license = exports.LICENSE;
var pre = (MODE === MODES.CAM ? "cnc-" : "print-") + (printSeq.toString().padStart(3,"0")), var pre = (MODE === MODES.CAM ? "cnc-" : "print-") + (printSeq.toString().padStart(3,"0")),
filename = pre,// + (new Date().getTime().toString(36)), filename = pre,// + (new Date().getTime().toString(36)),
fileext = settings.device.gcodeFExt || "gcode", fileext = settings.device.gcodeFExt || "gcode",
codeproc = settings.device.gcodeProc,
octo_host, octo_host,
octo_apik, octo_apik,
grid_host, grid_host,
grid_apik, grid_apik,
grid_target; grid_target;
// run gcode post processor function (when supplied and valid)
if (codeproc && self[codeproc]) {
gcode = self[codeproc](gcode);
}
function getBlob() { function getBlob() {
return new Blob( return new Blob(
[gcode], [gcode],
@ -2810,6 +2819,7 @@ self.kiri.license = exports.LICENSE;
gcodeLayer: valueOf(cmd.layer, []), gcodeLayer: valueOf(cmd.layer, []),
gcodePre: valueOf(code.pre, []), gcodePre: valueOf(code.pre, []),
gcodePost: valueOf(code.post, []), gcodePost: valueOf(code.post, []),
gcodeProc: valueOf(code.proc, ''),
gcodeDwell: valueOf(code.dwell, []), gcodeDwell: valueOf(code.dwell, []),
gcodeChange: valueOf(code['tool-change'], []), gcodeChange: valueOf(code['tool-change'], []),
gcodeFExt: valueOf(code['file-ext'], 'gcode'), gcodeFExt: valueOf(code['file-ext'], 'gcode'),

View file

@ -76,8 +76,8 @@ function lastmod(path) {
* @param {Function} fn * @param {Function} fn
* @returns {*} * @returns {*}
*/ */
function getCachedFile(filePath, fn) { function getCachedFile(filePath, cachePath, fn) {
var cachePath = "cache/"+filePath.replace(/\//g,"_"), var cachePath = "cache/" + cachePath.replace(/\//g,'_'),
cached = fileCache[filePath], cached = fileCache[filePath],
now = time(); now = time();
@ -160,16 +160,24 @@ function htmlScript(prefix, list) {
function concatCode(array) { function concatCode(array) {
var code = [], var code = [],
cached, cached,
path; cachepath,
filepath;
array.forEach(file => { array.forEach((file, index) => {
path = file.charAt(0) === '/' ? file : codePrefix + file + ".js"; if (file.charAt(0) === "/") {
cached = getCachedFile(path, function(path) { filepath = file;
return uglify.minify(path).code; cachepath = "js_mod" + file.replace(/\//g,'_');
array[index] = cachepath.substring(3).replace('.js','');
fileMap[cachepath.replace("js_","js/")] = filepath;
} else {
filepath = codePrefix + file + ".js";
cachepath = filepath;
}
cached = getCachedFile(filepath, cachepath, function(path) {
return uglify.minify(filepath).code;
}); });
code.push(cached); code.push(cached);
}); });
return code.join(''); return code.join('');
} }
@ -491,6 +499,10 @@ function handleJS(req, res, next) {
fpath = jspos > 0 ? spath.substring(0,jspos+3) : spath, fpath = jspos > 0 ? spath.substring(0,jspos+3) : spath,
cached = fileCache[fpath]; cached = fileCache[fpath];
if (fileMap[fpath]) {
fpath = fileMap[fpath];
}
fs.stat(fpath, (err, f) => { fs.stat(fpath, (err, f) => {
if (err || !f) return reply404(req, res); if (err || !f) return reply404(req, res);
@ -684,6 +696,7 @@ var ver = require('../js/license.js'),
startTime = time(), startTime = time(),
codePrefix = "js/", codePrefix = "js/",
fileCache = {}, fileCache = {},
fileMap = {},
filters_fdm = [], filters_fdm = [],
filters_cam = [], filters_cam = [],
modPaths = [], modPaths = [],

View file

@ -0,0 +1,35 @@
{
"pre":[
"; filename = kirimoto.gcode",
"; machine = dv1MW0A000",
"T0 ; select extruder #0",
"M104 S{temp} ; set nozzle temp",
"M109 S{temp} ; wait for nozzle to heat",
"M82 ; absolute extrusion mode",
"G28 ; home",
"G1 Z15 F6000 ; lower platform 15mm",
"G92 E0 ; zero out extruder position",
"G1 F200 E3 ; prime the extruder 3mm"
],
"post":[
"M107 ; fan off",
"M104 S0 ; set nozzle temp to 0",
"M140 S0 ; set bed temp to 0",
"G92 E0 ; zero out extruder position",
"G1 E-1 F300 ; retract filament",
"G28 X0 Y0 ; home X Y",
"M84 ; disable steppers"
],
"cmd":{
"fan_power": "M106 S{fan_speed}"
},
"proc": "btoa",
"file-ext": "3w",
"settings":{
"origin_center": false,
"extrude_abs": true,
"bed_width": 150,
"bed_depth": 150,
"build_height": 150
}
}