diff --git a/src/js/control-view.js b/src/js/control-view.js index 1d9c096..a22de0b 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -51,6 +51,7 @@ module.exports = { macrosLoading: false, show_gcodes: false, GCodeNotFound: false, + show_probe_dialog: false, filesUploaded: 0, totalFiles: 0, files_sortby: "By Upload Date", @@ -851,7 +852,10 @@ module.exports = { }, showProbeDialog: function (probeType) { - SvelteComponents.showDialog("Probe", { probeType }); + if(this.show_probe_dialog){ + this.show_probe_dialog = false; + } + SvelteComponents.showDialog("Probe", { probeType, isRotaryActive: this.state["2an"] == 3 }); }, run_macro: function (id) { if (this.state.macros[id].file_name == "default") { diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index e1c5462..06077d3 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -37,6 +37,15 @@ script#control-view-template(type="text/x-template") div(slot="footer") button.pure-button.button-error(@click="GCodeNotFound=false") | OK + + message(:show.sync="show_probe_dialog") + h3(slot="header") Probe Rotary + div(slot="body") + button.pure-button(:class="state['pw'] ? '' : 'load-on'", @click="showProbeDialog('xyz')") Probe XYZ + button.pure-button(:class="state['pw'] ? '' : 'load-on'", @click="showProbeDialog('z')") Probe Z + div(slot="footer") + button.pure-button(@click="show_probe_dialog=false") Cancel + table(style="table-layout: fixed; width: 100%;") tr(style="height: fit-content;") @@ -100,7 +109,7 @@ script#control-view-template(type="text/x-template") tr(v-if="state['2an'] == 3") td(style="height:100px", align="center", colspan="1") - button(@click="showProbeDialog('a')") + button(@click="show_probe_dialog=true") | Probe br | Rotary diff --git a/src/svelte-components/src/dialogs/DialogHost.svelte b/src/svelte-components/src/dialogs/DialogHost.svelte index f0bf798..cfee34d 100644 --- a/src/svelte-components/src/dialogs/DialogHost.svelte +++ b/src/svelte-components/src/dialogs/DialogHost.svelte @@ -22,6 +22,7 @@ type ProbeDialogPropsType = { open: boolean; probeType: "xyz" | "z"; + isRotaryActive: boolean; }; const ScreenRotationDialogProps = writable(); diff --git a/src/svelte-components/src/dialogs/ProbeDialog.svelte b/src/svelte-components/src/dialogs/ProbeDialog.svelte index 6ba5d87..eb7a699 100644 --- a/src/svelte-components/src/dialogs/ProbeDialog.svelte +++ b/src/svelte-components/src/dialogs/ProbeDialog.svelte @@ -70,7 +70,8 @@ ]; export let open; - export let probeType: "xyz" | "z" | "a"; + export let probeType: "xyz" | "z"; + export let isRotaryActive: Boolean; let currentStep: Step = "None"; let cutterDiameterString: string = ""; let cutterDiameterMetric: number; @@ -116,7 +117,7 @@ updateButtons(); } - $: if(probeType === 'a'){ + $: if(isRotaryActive){ stepLabels["PlaceProbeBlock"] = "Start Probe"; } @@ -130,14 +131,14 @@ const enableSafety = $Config.settings["probing-prompts"]; steps = [ - enableSafety && probeType !== "a" ? "CheckProbe" : undefined, - probeType === "xyz" || probeType === "a" ? "BitDimensions" : undefined, + enableSafety && !isRotaryActive ? "CheckProbe" : undefined, + probeType === "xyz" || isRotaryActive ? "BitDimensions" : undefined, enableSafety ? "PlaceProbeBlock" : undefined, "Probe", "Done", ].filter(isStep); - if(probeType != "a"){ + if(!isRotaryActive){ await stepCompleted("CheckProbe", probeContacted); } @@ -149,7 +150,7 @@ ); } - if (probeType === "a") { + if (isRotaryActive) { await stepCompleted("BitDimensions", userAcknowledged); localStorage.setItem( "cutterDiameterRotary", @@ -161,7 +162,7 @@ await stepCompleted("Probe", probingComplete, probingFailed); await stepCompleted("Done", userAcknowledged); - if (probeType === "xyz" || probeType === "a") { + if (probeType === "xyz" || isRotaryActive) { ControllerMethods.gotoZero("xy"); } } catch (err) { @@ -184,7 +185,6 @@ switch (probeType) { case "xyz": case "z": - case "a": break; default: @@ -258,30 +258,22 @@ } function executeProbe() { - //Probe Block - const probeBlockWidth = $Config.probe["probe-xdim"]; - const probeBlockLength = $Config.probe["probe-ydim"]; - const probeBlockHeight = $Config.probe["probe-zdim"]; - const slowSeek = $Config.probe["probe-slow-seek"]; - const fastSeek = $Config.probe["probe-fast-seek"]; + + const config = isRotaryActive ? $Config["probe-rotary"] : $Config.probe; + + const probeBlockWidth = config["probe-xdim"]; + const probeBlockLength = config["probe-ydim"]; + const probeBlockHeight = config["probe-zdim"]; + const slowSeek = config["probe-slow-seek"]; + const fastSeek = config["probe-fast-seek"]; const cutterLength = 12.7; const zLift = 1; - const xOffset = probeBlockWidth + cutterDiameterMetric / 2.0; - const yOffset = probeBlockLength + cutterDiameterMetric / 2.0; + const cutterDiameter = isRotaryActive ? cutterDiameterRotaryMetric : cutterDiameterMetric; + const xOffset = probeBlockWidth + cutterDiameter / 2.0; + const yOffset = probeBlockLength + cutterDiameter / 2.0; const zOffset = probeBlockHeight; - //Rotary - const probeRotaryWidth = $Config["probe-rotary"]["probe-xdim"]; - const probeRotaryLength = $Config["probe-rotary"]["probe-ydim"]; - const probeRotaryHeight = $Config["probe-rotary"]["probe-zdim"]; - - const fastSeekRotary = $Config["probe-rotary"]["probe-fast-seek"]; - const slowSeekRotary = $Config["probe-rotary"]["probe-slow-seek"]; - const xOffsetRotary = probeRotaryWidth + cutterDiameterRotaryMetric / 2.0; - const yOffsetRotary = probeRotaryLength + cutterDiameterRotaryMetric / 2.0; - const zOffsetRotary = probeRotaryHeight; - if (probeType === "z") { ControllerMethods.send(` G21 @@ -294,43 +286,6 @@ G91 G0 Z 25 - M2 - `); - } else if(probeType === "a") { - // After probing Z, we want to drop the bit down: - // Ideally, 12.7mm/0.5in - // And we don't want to be more than 90% down on the probe block - // Also, add zlift to compensate for the fact that we lift after probing Z - const plunge = Math.min(cutterLength, zOffsetRotary * 0.9) + zLift; - - ControllerMethods.send(` - G21 - G92 X0 Y0 Z0 - - G38.2 Z -25 F${fastSeekRotary} - G91 G1 Z 1 - G38.2 Z -2 F${slowSeekRotary} - G92 Z ${zOffsetRotary} - - G91 G0 Z ${zLift} - G91 G0 X 20 - G91 G0 Z ${-plunge} - G38.2 X -20 F${fastSeekRotary} - G91 G1 X 1 - G38.2 X -2 F${slowSeekRotary} - G92 X ${xOffsetRotary} - - G91 G0 X 1 - G91 G0 Y 20 - G91 G0 X -20 - G38.2 Y -20 F${fastSeekRotary} - G91 G1 Y 1 - G38.2 Y -2 F${slowSeekRotary} - G92 Y ${yOffsetRotary} - - G91 G0 Y 3 - G91 G0 Z 25 - M2 `); } else { @@ -403,7 +358,7 @@ Attach the probe magnet to the collet, then touch the probe block to the bit.

- {#if probeType !== "a"} + {#if !isRotaryActive}
Note:
Position the bit above the probe and attach the probe magnet. {:else} Place the probe block face down, with the bit above the @@ -451,7 +406,7 @@ {/if}

- {#if probeType !== "a"} + {#if !isRotaryActive} {:else}

- {#if probeType === "a"} + {#if isRotaryActive} Probing complete {:else} Don't forget to put away the probe! {/if}

- {#if probeType !== "a"} + {#if !isRotaryActive} {/if} - {#if probeType === "xyz" || probeType === "a"} + {#if probeType === "xyz" || isRotaryActive}

The machine will now move to the XY origin.

Watch your hands!