Brought back "disable safety prompts" for probing

This commit is contained in:
David Carley
2022-09-14 05:11:39 +00:00
parent c7670ce7cc
commit a09ec6c563
4 changed files with 164 additions and 102 deletions

View File

@@ -24,6 +24,11 @@
"unit": "mm/min²", "unit": "mm/min²",
"default": 200000 "default": 200000
}, },
"probing-prompts": {
"help": "Enable or disable safety prompts during and after probing",
"type": "bool",
"default": true
},
"gamepad-default-type": { "gamepad-default-type": {
"help": "When a gamepad is not recognized, treat it as the selected type of gamepad.", "help": "When a gamepad is not recognized, treat it as the selected type of gamepad.",
"type": "enum", "type": "enum",

View File

@@ -22,6 +22,21 @@
scale?: number; scale?: number;
}; };
const namesByKey = {
"gamepad-default-type": "Default type",
"probing-prompts": "Show safety prompts",
"probe-xdim": "Probe block width",
"probe-ydim": "Probe block length",
"probe-zdim": "Probe block height",
"probe-fast-seek": "Fast seek speed",
"probe-slow-seek": "Slow seek speed",
"program-start": "On program start",
"tool-change": "On tool change",
"program-end": "On program end",
"max-deviation": "Maximum deviation",
"junction-accel": "Junction acceleration",
};
export let key: string; export let key: string;
let keyParts: string[]; let keyParts: string[];
let template: Template; let template: Template;
@@ -33,7 +48,7 @@
onMount(() => { onMount(() => {
keyParts = (key || "").split("."); keyParts = (key || "").split(".");
template = getTemplate(); template = getTemplate();
name = keyParts[keyParts.length - 1]; name = namesByKey[keyParts.at(-1)] || keyParts.at(-1);
title = getTitle(); title = getTitle();
value = getValue(); value = getValue();
}); });
@@ -81,7 +96,7 @@
target = target[part]; target = target[part];
} }
const value = coerceValue(event.target.value); const value = getValueFromElement(event.target);
target[keyParts[keyParts.length - 1]] = value; target[keyParts[keyParts.length - 1]] = value;
return config; return config;
@@ -90,14 +105,17 @@
ControllerMethods.dispatch("config-changed"); ControllerMethods.dispatch("config-changed");
} }
function coerceValue(value) { function getValueFromElement(element) {
switch (template.type) { switch (template.type) {
case "float": case "float":
case "int": case "int":
return Number(value); return Number(element.value);
case "bool":
return element.checked;
default: default:
return value; return element.value;
} }
} }
@@ -138,7 +156,12 @@
{/each} {/each}
</select> </select>
{:else if template.type === "bool"} {:else if template.type === "bool"}
<input {name} type="checkbox" bind:value on:input={onChange} /> <input
{name}
type="checkbox"
checked={value}
on:change={onChange}
/>
{:else if template.type === "float"} {:else if template.type === "float"}
<input <input
{name} {name}

View File

@@ -14,95 +14,116 @@
<ScreenRotationDialog bind:open={showScreenRotationDialog} /> <ScreenRotationDialog bind:open={showScreenRotationDialog} />
<SetTimeDialog bind:open={showSetTimeDialog} /> <SetTimeDialog bind:open={showSetTimeDialog} />
<h1>Settings</h1> <div class="settings-view">
<h1>Settings</h1>
<div class="pure-form pure-form-aligned"> <div class="pure-form pure-form-aligned">
<h2>User Interface</h2> <h2>User Interface</h2>
<fieldset> <fieldset>
<div class="pure-control-group"> <div class="pure-control-group">
<label for="screen-rotation" /> <label for="screen-rotation" />
<Button <Button
name="screen-rotation" name="screen-rotation"
touch touch
variant="raised" variant="raised"
on:click={() => (showScreenRotationDialog = true)} on:click={() => (showScreenRotationDialog = true)}
> >
<Label>Change Screen Rotation</Label> <Label>Change Screen Rotation</Label>
</Button> </Button>
</div> </div>
<div class="pure-control-group"> <div class="pure-control-group">
<label for="set-time" /> <label for="set-time" />
<Button <Button
name="set-time" name="set-time"
touch touch
variant="raised" variant="raised"
on:click={() => (showSetTimeDialog = true)} on:click={() => (showSetTimeDialog = true)}
> >
<Label>Change Time & Timezone</Label> <Label>Change Time & Timezone</Label>
</Button> </Button>
</div> </div>
</fieldset> </fieldset>
<h2>Gamepads / Joypads</h2> <h2>Gamepads / Joypads</h2>
<fieldset> <fieldset>
<ConfigTemplatedInput key={`settings.gamepad-default-type`} /> <ConfigTemplatedInput key={`settings.gamepad-default-type`} />
</fieldset> <div class="tip">
If your gamepad doesn't work as expected, try one of the other
types.
</div>
</fieldset>
<p> <h2>Probing</h2>
If you have a gamepad that is not officially supported, and doesn't seem <fieldset>
to be working right, try changing <tt>gamepad-default-type</tt> to one of <ConfigTemplatedInput key={`settings.probing-prompts`} />
the other types. <div class="tip">
</p> Onefinity highly recommends that you keep the safety prompts
enabled. If you choose to live dangerously, and disable the
safety prompts, Onefinity cannot be held responsible.
</div>
<fieldset> <br />
<h2>Probe Dimensions</h2>
{#each Object.keys(configTemplate.probe) as key}
{#if key !== "probe-diameter"}
<ConfigTemplatedInput key={`probe.${key}`} />
{/if}
{/each}
</fieldset>
<fieldset> {#each Object.keys(configTemplate.probe) as key}
<h2>GCode</h2> {#if key !== "probe-diameter"}
{#each Object.keys(configTemplate.gcode) as key} <ConfigTemplatedInput key={`probe.${key}`} />
<ConfigTemplatedInput key={`gcode.${key}`} /> {/if}
{/each} {/each}
</fieldset> </fieldset>
<h2>Path Accuracy</h2> <fieldset>
<fieldset> <h2>GCode</h2>
<ConfigTemplatedInput key={`settings.max-deviation`} /> {#each Object.keys(configTemplate.gcode) as key}
</fieldset> <ConfigTemplatedInput key={`gcode.${key}`} />
{/each}
</fieldset>
<p> <h2>Path Accuracy</h2>
Lower <tt>max-deviation</tt> to follow the programmed path more precisely <fieldset>
but at a slower speed. <ConfigTemplatedInput key={`settings.max-deviation`} />
</p>
<p> <div class="tip">
In order to improve traversal speed, the path planner may merge Lower the maximum deviation to follow the programmed path more
consecutive moves or round off sharp corners if doing so would deviate precisely but at a slower speed.
from the program path by less than <tt>max-deviation</tt>. </div>
</p>
<p> <div class="tip">
GCode commands In order to improve traversal speed, the path planner may merge
<a href={`${gcodeURL}#gcode:g61`} target="_blank">G61, G61.1</a> consecutive moves or round off sharp corners if doing so would
and <a href={`${gcodeURL}#gcode:g64`} target="_blank"> G64</a> also affect deviate from the program path by less than the maximum
path planning accuracy. deviation.
</p> </div>
<h2>Cornering Speed (Advanced)</h2> <div class="tip">
<fieldset> GCode commands
<ConfigTemplatedInput key={`settings.junction-accel`} /> <a href={`${gcodeURL}#gcode:g61`} target="_blank">G61, G61.1</a>
</fieldset> and <a href={`${gcodeURL}#gcode:g64`} target="_blank">G64</a> also
affect path planning accuracy.
</div>
</fieldset>
<p> <h2>Cornering Speed (Advanced)</h2>
Junction acceleration limits the cornering speed the planner will allow. <fieldset>
Increasing this value will allow for faster traversal of corners but may <ConfigTemplatedInput key={`settings.junction-accel`} />
cause the planner to violate axis jerk limits and stall the motors. Use <div class="tip">
with caution. Junction acceleration limits the cornering speed the planner
</p> will allow. Increasing this value will allow for faster
traversal of corners but may cause the planner to violate axis
jerk limits and stall the motors. Use with caution.
</div>
</fieldset>
</div>
</div> </div>
<style lang="scss">
.settings-view {
.tip {
margin-left: 210px;
margin-bottom: 15px;
font-style: italic;
font-size: 90%;
line-height: 1.5;
}
}
</style>

View File

@@ -105,10 +105,14 @@
$probingActive = true; $probingActive = true;
assertValidProbeType(); assertValidProbeType();
$probingFailed = false;
const enableSafety = $Config.settings["probing-prompts"];
steps = [ steps = [
"CheckProbe", enableSafety ? "CheckProbe" : undefined,
probeType === "xyz" ? "BitDimensions" : undefined, probeType === "xyz" ? "BitDimensions" : undefined,
"PlaceProbeBlock", enableSafety ? "PlaceProbeBlock" : undefined,
"Probe", "Probe",
"Done", "Done",
].filter<Step>(isStep); ].filter<Step>(isStep);
@@ -163,6 +167,10 @@
) { ) {
currentStep = nextStep; currentStep = nextStep;
if (!steps.includes(currentStep)) {
return;
}
clearFlags(); clearFlags();
updateButtons(); updateButtons();
@@ -184,7 +192,6 @@
$cancelled = false; $cancelled = false;
$probeContacted = false; $probeContacted = false;
$probingStarted = false; $probingStarted = false;
$probingFailed = false;
$probingComplete = false; $probingComplete = false;
$userAcknowledged = false; $userAcknowledged = false;
} }
@@ -310,10 +317,12 @@
{/each} {/each}
</ul> </ul>
</div> </div>
<p style="width: 100%"> <div style="width: 100%">
{#if currentStep === "CheckProbe"} {#if currentStep === "CheckProbe"}
Attach the probe magnet to the collet, then touch the probe <p>
block to the bit. Attach the probe magnet to the collet, then touch the probe
block to the bit.
</p>
<Icon <Icon
data={probeType === "xyz" ? CheckXYZ : CheckZ} data={probeType === "xyz" ? CheckXYZ : CheckZ}
@@ -334,13 +343,15 @@
<Icon data={BitDiameter} size="150px" class="probe-icon-svg" /> <Icon data={BitDiameter} size="150px" class="probe-icon-svg" />
{:else if currentStep === "PlaceProbeBlock"} {:else if currentStep === "PlaceProbeBlock"}
{#if probeType === "xyz"} <p>
Place the probe block face up, on the lower-left corner of {#if probeType === "xyz"}
your workpiece. Place the probe block face up, on the lower-left corner
{:else} of your workpiece.
Place the probe block face down, with the bit above the {:else}
recess. Place the probe block face down, with the bit above the
{/if} recess.
{/if}
</p>
<Icon <Icon
data={probeType === "xyz" ? PlaceXYZ : PlaceZ} data={probeType === "xyz" ? PlaceXYZ : PlaceZ}
@@ -354,12 +365,14 @@
'Next'. 'Next'.
</p> </p>
{:else if currentStep === "Probe"} {:else if currentStep === "Probe"}
Probing in progress... <p>Probing in progress...</p>
<LinearProgress indeterminate /> <LinearProgress indeterminate />
{:else if currentStep === "Done"} {:else if currentStep === "Done"}
{#if $probingFailed} {#if $probingFailed}
Could not find the probe block during probing! <h3>Emergency Stop!</h3>
<p>Could not find the probe block during probing!</p>
<p> <p>
Make sure the tip of the bit is less than {metric Make sure the tip of the bit is less than {metric
@@ -368,7 +381,7 @@
above the probe block, and try again. above the probe block, and try again.
</p> </p>
{:else} {:else}
Don't forget to put away the probe! <p>Don't forget to put away the probe!</p>
<Icon <Icon
data={probeType === "xyz" ? PutAwayXYZ : PutAwayZ} data={probeType === "xyz" ? PutAwayXYZ : PutAwayZ}
@@ -384,7 +397,7 @@
{/if} {/if}
{/if} {/if}
{/if} {/if}
</p> </div>
</Content> </Content>
<Actions> <Actions>