From a7554a7f64059421ba0f3f47633f462bb6066f80 Mon Sep 17 00:00:00 2001 From: KGN Date: Fri, 16 Feb 2024 13:51:48 -0500 Subject: [PATCH] Laser looks at right units for conversion --- src/app/widgets/Spindle/index.jsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/app/widgets/Spindle/index.jsx b/src/app/widgets/Spindle/index.jsx index 3f46bfae4..306666a7e 100644 --- a/src/app/widgets/Spindle/index.jsx +++ b/src/app/widgets/Spindle/index.jsx @@ -358,7 +358,7 @@ class SpindleWidget extends PureComponent { } const commands = [ preferredUnits, - ...this.getSpindleOffsetCode(), + ...this.getSpindleOffsetCode(preferredUnits), `$30=${spindleMax}`, `$31=${spindleMin}`, '$32=0', @@ -415,15 +415,14 @@ class SpindleWidget extends PureComponent { return [round(Number(x) + Number(xOffset), units), round(Number(y) + Number(yOffset), units)]; } - getLaserOffsetCode() { + getLaserOffsetCode(preferredUnits) { const laser = this.config.get('laser'); - const { units } = this.props; this.setState({ laser }); let { xOffset, yOffset } = laser; - if (units === IMPERIAL_UNITS) { + if (preferredUnits === IMPERIAL_UNITS) { xOffset = convertToImperial(xOffset); yOffset = convertToImperial(yOffset); } else { @@ -449,8 +448,7 @@ class SpindleWidget extends PureComponent { return offsetQuery; } - getSpindleOffsetCode() { - const { units } = this.props; + getSpindleOffsetCode(preferredUnits) { const laser = this.config.get('laser'); this.setState({ laser @@ -459,7 +457,7 @@ class SpindleWidget extends PureComponent { let { xOffset, yOffset } = laser; xOffset = Number(xOffset) * -1; yOffset = Number(yOffset) * -1; - if (units === IMPERIAL_UNITS) { + if (preferredUnits === IMPERIAL_UNITS) { xOffset = convertToImperial(xOffset); yOffset = convertToImperial(yOffset); } else { @@ -501,7 +499,7 @@ class SpindleWidget extends PureComponent { } const commands = [ preferredUnits, - ...this.getLaserOffsetCode(), + ...this.getLaserOffsetCode(preferredUnits), `$30=${maxPower}`, `$31=${minPower}`, '$32=1',