From c8ec0aa498204e81c9f3799a4f17f1734a696a7f Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 8 Mar 2021 21:57:28 -0500 Subject: [PATCH] add belt peel guard to prevent deflection on long prints as they leave the belt end --- app.js | 2 ++ src/kiri/conf.js | 1 + src/kiri/init.js | 3 ++- src/mode/fdm/export.js | 13 ++++++++++++- web/kiri/lang/en.js | 2 ++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 94b4b6ec..9fcaeca4 100644 --- a/app.js +++ b/app.js @@ -167,6 +167,8 @@ function initModule(mod, file, dir) { time: time, guid: guid, mkdirs: util.mkdir, + isfile: util.isfile, + confdir: util.confdir, datadir: util.datadir, lastmod: lastmod, obj2string: obj2string, diff --git a/src/kiri/conf.js b/src/kiri/conf.js index 8545ea61..e1b4f47c 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -341,6 +341,7 @@ outputLayerRetract: false, outputOriginCenter: true, outputLoopLayers: "", + outputPeelGuard: 0, outputInvertX: false, outputInvertY: false, detectThinWalls: false, diff --git a/src/kiri/init.js b/src/kiri/init.js index 7c90ab0f..013f2992 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -1788,7 +1788,8 @@ arcTolerance: UC.newInput(LANG.ad_arct_s, {title:LANG.ad_arct_l, bound:UC.bound(0,1.0), convert:UC.toFloat, modes:FDM, show:() => { return isDanger() && isNotBelt() }}), antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM}), fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), - gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, comma:true}), + outputPeelGuard: UC.newInput(LANG.ag_peel_s, {title:LANG.ag_peel_l, convert:UC.toInt, modes:FDM, comma:true, show:isBelt}), + gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, comma:true, show:isNotBelt}), outputLoopLayers: UC.newInput(LANG.ag_loop_s, {title:LANG.ag_loop_l, modes:FDM, comma:true, show:isBelt}), outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM}), diff --git a/src/mode/fdm/export.js b/src/mode/fdm/export.js index 4ed0bb7e..8a0cdda4 100644 --- a/src/mode/fdm/export.js +++ b/src/mode/fdm/export.js @@ -47,6 +47,9 @@ lout = null, last = null, zpos = 0, + bmax = 0, + blast = 0, + blastz = 0, process = settings.process, loops = process.outputLoopLayers, zhop = process.zHopDistance || 0, // range @@ -55,6 +58,7 @@ retSpeed = process.outputRetractSpeed * 60, // range retDwell = process.outputRetractDwell || 0, // range timeDwell = retDwell / 1000, + peelGuard = process.outputPeelGuard || 0, arcDist = isBelt || !isDanger ? 0 : (process.arcTolerance || 0), originCenter = process.outputOriginCenter, offset = originCenter ? null : { @@ -272,7 +276,7 @@ let epos = isBelt ? { x: pos.x, y: pos.y, z: pos.z } : pos; if (isBelt) { epos.x = originCenter ? -pos.x : device.bedWidth - pos.x; - epos.z = pos.z * icos; + epos.z = blastz = pos.z * icos; epos.y = -pos.y + epos.z * bcos; lout = epos; } @@ -335,6 +339,7 @@ (process.firstSliceHeight || process.sliceHeight) : path.height); zpos = path.z || zpos; + bmax = Math.max(bmax, pos.z * icos); subst.z = subst.Z = zpos.round(3); subst.e = subst.E = outputLength; subst.layer = layer; @@ -342,6 +347,12 @@ if (isBelt) { pos.z = zpos; + if (peelGuard && bmax > peelGuard && blast < peelGuard) { + peelGuard += 50; + append(`G0 Z${(blast + 55).round(decimals)} F200 ; peel guard`); + append(`G0 Z${blastz.round(decimals)} F200 ; unpeel`); + } + blast = bmax; } if (pauseCmd && pause.indexOf(layer) >= 0) { diff --git a/web/kiri/lang/en.js b/web/kiri/lang/en.js index 036f16c9..7244e587 100644 --- a/web/kiri/lang/en.js +++ b/web/kiri/lang/en.js @@ -585,6 +585,8 @@ kiri.lang['en-us'] = { ag_menu: "gcode", ag_nozl_s: "nozzle", ag_nozl_l: "select output nozzle or head", + ag_peel_s: "peel guard", + ag_peel_l: ["starting at this belt z positoin","periodically roll the print off and","back on to the belt to unstick it","and prevent rolling deflection"], ag_paws_s: "pause layers", ag_paws_l: ["comma-separated list of layers","to inject pause commands before"], ag_loop_s: "loop layers",