Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start From Line After Alarm #472

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/app/sagas/controllerSagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import {
ERROR,
JOB_TYPES,
JOB_STATUS,
GRBL,
} from 'app/constants';
import { connectToLastDevice } from 'app/containers/Firmware/utils/index';
import { updateWorkspaceMode } from 'app/lib/rotary';
Expand Down Expand Up @@ -616,14 +617,22 @@ export function* initialize() {
pubsub.publish('firmware:update', status);
});

controller.addListener('error', (error) => {
controller.addListener('error', (error, wasRunning) => {
const homingEnabled = _get(reduxStore.getState(), 'controller.settings.settings.$22');

if (ALARM_ERROR_TYPES.includes(error.type)) {
updateAlarmsErrors(error);
}
// if (isElectron() && (alarmReg.test(error.type) || errorReg.test(error.type))) {
// window.ipcRenderer.send('logError:electron', error);
// }
pubsub.publish('error', error);

// set need recovery for start from line when alarm happens
if (error.type === ALARM && wasRunning) {
console.log(error.lineNumber);
pubsub.publish('disconnect:recovery', error.lineNumber, homingEnabled);
}
});

controller.addListener('wizard:next', (stepIndex, substepIndex) => {
Expand All @@ -647,7 +656,7 @@ export function* initialize() {
}
}

if (type === FILE_TYPE.FOUR_AXIS && controller.type === 'Grbl') {
if (type === FILE_TYPE.FOUR_AXIS && controller.type === GRBL) {
Confirm({
title: '4 Axis File Loaded',
content: 'G-Code contains 4 simultaneous axis commands which are not supported at this time and cannot be run.',
Expand Down
6 changes: 5 additions & 1 deletion src/server/controllers/Grblhal/GrblHalController.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ class GrblHalController {

if (alarm) {
// Grbl v1.1
const isRunning = this.workflow.isRunning();
if (isRunning) {
this.workflow.stop();
}
this.emit('serialport:read', `ALARM:${code} (${alarm.message})`);
this.emit('error', {
type: ALARM,
Expand All @@ -825,7 +829,7 @@ class GrblHalController {
lineNumber: isFileError ? received + 1 : '',
origin: errorOrigin,
controller: GRBLHAL,
});
}, isRunning);
// Force propogation of current state on alarm
this.state = this.runner.state;

Expand Down
Loading