Skip to content

Commit

Permalink
Spindle/laser toggle no longer adjust 30/31 if SLB_Laser selected
Browse files Browse the repository at this point in the history
  • Loading branch information
kglovern committed Mar 14, 2024
1 parent 835d4e6 commit 1700e51
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/app/widgets/Spindle/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class SpindleWidget extends PureComponent {
}

enableSpindleMode() {
const { units, spindleMax: maxPower, spindleMin: minPower } = this.props;
const { units, spindleMax: maxPower, spindleMin: minPower, spindle } = this.props;
const preferredUnits = store.get('workspace.units') === IMPERIAL_UNITS ? 'G20' : 'G21';
const active = this.getSpindleActiveState();

Expand All @@ -362,6 +362,12 @@ class SpindleWidget extends PureComponent {
laser.minPower = minPower;
this.config.set('laser', laser);

const powerCommands = (spindle.label === 'SLB_LASER') ? []
: [
`$30=${spindleMax}`,
`$31=${spindleMin}`,
];

if (active) {
this.isSpindleOn = false;
controller.command('gcode', 'M5');
Expand All @@ -370,8 +376,7 @@ class SpindleWidget extends PureComponent {
const commands = [
preferredUnits,
...this.getSpindleOffsetCode(preferredUnits),
`$30=${spindleMax}`,
`$31=${spindleMin}`,
...powerCommands,
'$32=0',
units
];
Expand Down Expand Up @@ -513,7 +518,7 @@ class SpindleWidget extends PureComponent {


enableLaserMode() {
const { units, spindleMax, spindleMin } = this.props;
const { units, spindleMax, spindleMin, spindle } = this.props;
const preferredUnits = store.get('workspace.units') === IMPERIAL_UNITS ? 'G20' : 'G21';
const active = this.getSpindleActiveState();

Expand All @@ -525,15 +530,21 @@ class SpindleWidget extends PureComponent {
this.config.set('spindleMin', spindleMin);
this.config.set('spindleMax', spindleMax);

const powerCommands = (spindle.label === 'SLB_LASER') ? []
: [
`$30=${maxPower}`,
`$31=${minPower}`,
];


if (active) {
this.isLaserOn = false;
controller.command('gcode', 'M5');
}
const commands = [
preferredUnits,
...this.getLaserOffsetCode(preferredUnits),
`$30=${maxPower}`,
`$31=${minPower}`,
...powerCommands,
'$32=1',
units
];
Expand Down

0 comments on commit 1700e51

Please sign in to comment.