Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kglovern committed Feb 28, 2024
2 parents 09c8a11 + 15d9934 commit c26fd38
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/app/widgets/NavbarConnection/FirmwareSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
import React from 'react';
import cx from 'classnames';
import { uniqueId } from 'lodash';
import { GRBL } from 'app/constants';
import styles from './Index.styl';

const FirmwareSelector = ({ options = [], selectedFirmware, handleSelect }) => {
selectedFirmware = selectedFirmware || GRBL; // null check
return (
<div className={styles.firmwareSelector}>
<div className={styles.selectorWrapper}>
Expand Down
19 changes: 5 additions & 14 deletions src/server/controllers/Grblhal/GrblHalController.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ class GrblHalController {
this.sender.unhold();
}
this.sender.ack();
this.sender.next();
this.sender.next({ isOk: true });
return;
}

Expand All @@ -692,7 +692,7 @@ class GrblHalController {
log.debug(`Stop sending G-code: hold=${hold}, sent=${sent}, received=${received + 1}`);
}
this.sender.ack();
this.sender.next();
this.sender.next({ isOk: true });
return;
}

Expand Down Expand Up @@ -1633,7 +1633,7 @@ class GrblHalController {
} else {
this.workflow.pause();
await delay(100);
this.write('!');
this.write(GRBLHAL_REALTIME_COMMANDS.FEED_HOLD);
}
},
'resume': () => {
Expand All @@ -1642,24 +1642,15 @@ class GrblHalController {
},
'gcode:resume': async () => {
log.debug('gcode:resume called - program to continue sending');
const [type] = args;
if (this.event.hasEnabledEvent(PROGRAM_RESUME)) {
this.feederCB = () => {
if (type === GRBLHAL) {
this.write(GRBLHAL_REALTIME_COMMANDS.CYCLE_START);
} else {
this.write('~');
}
this.write(GRBLHAL_REALTIME_COMMANDS.CYCLE_START);
this.workflow.resume();
this.feederCB = null;
};
this.event.trigger(PROGRAM_RESUME);
} else {
if (type === GRBLHAL) {
this.write(GRBLHAL_REALTIME_COMMANDS.CYCLE_START);
} else {
this.write('~');
}
this.write(GRBLHAL_REALTIME_COMMANDS.CYCLE_START);
await delay(1000);
this.workflow.resume();
}
Expand Down
12 changes: 6 additions & 6 deletions src/server/lib/Sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class SPCharCounting {
}
}

process() {
this.callback && this.callback(this);
process(isOk) {
this.callback && this.callback(this, isOk);
}

reset() {
Expand Down Expand Up @@ -195,8 +195,8 @@ class Sender extends events.EventEmitter {

// character-counting
if (type === SP_TYPE_CHAR_COUNTING) {
this.sp = new SPCharCounting(options, (sp) => {
if (sp.queue.length > 0) {
this.sp = new SPCharCounting(options, (sp, isOk) => {
if (sp.queue.length > 0 && isOk) { // only remove line length from buffer if ok was sent
const lineLength = sp.queue.shift();
sp.dataLength -= lineLength;
}
Expand Down Expand Up @@ -410,7 +410,7 @@ class Sender extends events.EventEmitter {
// Tells the sender to send more data.
// @return {boolean} Returns true on success, false otherwise.
next(options = {}) {
const { startFromLine, timePaused, forceEnd } = options;
const { startFromLine, timePaused, forceEnd, isOk } = options;

if (!this.state.gcode) {
return false;
Expand Down Expand Up @@ -451,7 +451,7 @@ class Sender extends events.EventEmitter {
}

if (this.sp) {
this.sp.process();
this.sp.process(isOk);
}

// Elapsed Time
Expand Down

0 comments on commit c26fd38

Please sign in to comment.