Skip to content

Commit

Permalink
Fix for alarms on HAL with lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
kglovern committed Mar 19, 2024
1 parent fa957e5 commit 2544609
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/server/controllers/Grblhal/GrblHalController.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,8 @@ class GrblHalController {
this.runner.on('alarm', (res) => {
const code = Number(res.message) || this.state.status.subState;
//const alarm = _.find(this.settings.alarms, { id: code });
const alarm = this.settings.alarms[code];
const alarm = this.settings.alarms[code.toString()];
console.log(alarm);

const { lines, received, name } = this.sender.state;
const { outstanding } = this.feeder.state;
Expand Down Expand Up @@ -824,7 +825,7 @@ class GrblHalController {
if (isRunning) {
this.workflow.stop();
}
this.emit('serialport:read', `ALARM:${code} (${alarm.message})`);
this.emit('serialport:read', `ALARM:${code} (${alarm.description})`);
this.emit('error', {
type: ALARM,
code: code,
Expand Down
3 changes: 2 additions & 1 deletion src/server/controllers/Grblhal/GrblHalRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,11 @@ class GrblHalRunner extends events.EventEmitter {
return;
}
if (type === GrblHalLineParserResultAlarmDetails) {
this.settings.alarms[Number(payload.id)] = {
this.settings.alarms[payload.id] = {
description: payload.description,
id: payload.id
};

this.emit('alarmDetail', this.settings.alarms);
return;
}
Expand Down

0 comments on commit 2544609

Please sign in to comment.