improve module file paths. add XYZ DaVinci Mini

This commit is contained in:
Stewart Allen 2018-01-06 09:45:22 -05:00
commit 8fe4a45f19
2 changed files with 55 additions and 9 deletions

View file

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

View file

@ -0,0 +1,33 @@
{
"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}"
},
"settings":{
"origin_center": false,
"extrude_abs": true,
"bed_width": 150,
"bed_depth": 150,
"build_height": 150
}
}