Skip to content

Commit

Permalink
Merge branch 'G_report_fixes'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/server/controllers/Grblhal/GrblHalController.js
  • Loading branch information
kglovern committed Dec 16, 2024
2 parents 9f8fccd + a95cf30 commit 6d2074d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 28 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,21 @@ gSender is also designed in a way that it can be run locally on your computer br

## 🕣 Development History

### 1.4.11 (December 16th)
- Added "Skip Dialog" option to code toolchange which combines both blocks and skips the "Continue" dialog
- Diagnostics now generates a zip file which includes the original diagnostic PDF, a copy of current gSender settings, and any loaded toolpath for better support.
- Continuous jogging now bitwise compares homing location to avoid non-XYZ axes causing invalid corner detection.
- You are now able to update EEPROM values using the firmware tool when in Alarm state.
- Start from line now starts the spindle after the Z safe movement but before X and Y.
- Fix for A axis jog keybinds not working on standard GRBL controller.
- Reverted HAL changes $G using the realtime alternative to reduce instances of error 1 since it was not playing nicely with the new line parser.
- Fix for available axes and axes count not being emitted properly when disconnecting and reconnecting over ethernet.
- Auto Zero touch plate probing now properly converts bit diameter when using imperial preferred units and a specific bit size.
- Available ports are now case insensitive when matching known controller types (Thanks Dymk!)
- Macros no longer overflow the macro widget.
- Tweak to 30X30 machine profile for missing acceleration change for $111.
- Fixed rare situation where connecting to grblHAL controller, disconnecting, and reconnecting to GRBL controller caused invalid laser/spindle mode toggle behaviour.

### 1.4.10 (October 28, 2024)
- Jog no longer sends double jog commands on touch devices
- $G output emitted to UI when connected using grblHAL and manually sent
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/Preferences/About/releases.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["### 1.4.10 (October 28, 2024)","- Jog no longer sends double jog commands on touch devices","- $G output emitted to UI when connected using grblHAL and manually sent","- Altmill profile updated $103 A steps to account for compiled microstepping","- SLB profiles updated with new values","- Updated defaults on Mk2, Mk1, and MillOne profiles","- AutoZero touch routine updated when running specific diameter bits to be more accurate, and retract distance on Z slightly increased for non-tip routines.","- Rotary toggle no longer updates values when cancelled on grblHAL.","- Changed Spindle/Laser toggle behaviour for when to use gSender settings vs EEPROM settings for laser offset and spindle/laser min and max.","- Custom theme visualizer background now saving correctly.","- Altmill profile now at top of profiles with other Sienci Machines","### 1.4.9 (August 5, 2024)","- Fix for time remaining converting timestamps incorrectly","- Firmware groups now always emitted to UI on connection","- Reduced situations where error 1 should appear on connection or homing","- Alterations to Altmill default profile for Z acceleration","- Enabling rotary mode for grblHAL now disables homing, and disabling rotary mode restores your previous homing value","- Updated Longmill HAL A axis travel resolution for compiled microstepping value","- Main window should no longer be focused on load file dialog","### 1.4.8 (July 11, 2024)","- Added Altmill profiles","- Start from line now also accounts for A axis if file contains those movements","- Fixed situation where progress bar could be greater than 100%","- Some time estimation alterations specifically when pausing jobs","- Fixed issue where console copy prompt stated limit other than 50","- Spindle delay on start is now a configurable value in ms","- Changes to ethernet behaviour to allow reconnection in more cases the board closes the connection early","- Maintenance tasks that are due now prompt the user to take care of them on application start","- Changed max value for spindle RPM in rotary surfacing tool","- Fix for rotary tab gaining focus and preventing keybinds from working","- Changes to console scrollbar size and sensitivity","- Setting A-axis zero now updates visualizer rotation correctly","- Homing enabled in diagnostics now correct for SLB","- A-axis DRO with $13 enabled now no longer converts incorrectly","- Relative Go To now correctly uses input values for all 3 axes","- Alarm 14 and 17 now reset and unlock instead of just unlock using UI buttons","- Firmware tool inputs now disabled in Alarm state","- Added preference for end of job modal to not appear","- Fixed crash on toggling lightweight mode","- End of probe code now correctly restore G90/G91 to previous state"]
["### 1.4.11 (December 16th)","- Added \"Skip Dialog\" option to code toolchange which combines both blocks and skips the \"Continue\" dialog","- Diagnostics now generates a zip file which includes the original diagnostic PDF, a copy of current gSender settings, and any loaded toolpath for better support.","- Continuous jogging now bitwise compares homing location to avoid non-XYZ axes causing invalid corner detection.","- You are now able to update EEPROM values using the firmware tool when in Alarm state.","- Start from line now starts the spindle after the Z safe movement but before X and Y.","- Fix for A axis jog keybinds not working on standard GRBL controller.","- Reverted HAL changes $G using the realtime alternative to reduce instances of error 1 since it was not playing nicely with the new line parser.","- Fix for available axes and axes count not being emitted properly when disconnecting and reconnecting over ethernet.","- Auto Zero touch plate probing now properly converts bit diameter when using imperial preferred units and a specific bit size.","- Available ports are now case insensitive when matching known controller types (Thanks Dymk!)","- Macros no longer overflow the macro widget.","- Tweak to 30X30 machine profile for missing acceleration change for $111.","- Fixed rare situation where connecting to grblHAL controller, disconnecting, and reconnecting to GRBL controller caused invalid laser/spindle mode toggle behaviour.","### 1.4.10 (October 28, 2024)","- Jog no longer sends double jog commands on touch devices","- $G output emitted to UI when connected using grblHAL and manually sent","- Altmill profile updated $103 A steps to account for compiled microstepping","- SLB profiles updated with new values","- Updated defaults on Mk2, Mk1, and MillOne profiles","- AutoZero touch routine updated when running specific diameter bits to be more accurate, and retract distance on Z slightly increased for non-tip routines.","- Rotary toggle no longer updates values when cancelled on grblHAL.","- Changed Spindle/Laser toggle behaviour for when to use gSender settings vs EEPROM settings for laser offset and spindle/laser min and max.","- Custom theme visualizer background now saving correctly.","- Altmill profile now at top of profiles with other Sienci Machines","### 1.4.9 (August 5, 2024)","- Fix for time remaining converting timestamps incorrectly","- Firmware groups now always emitted to UI on connection","- Reduced situations where error 1 should appear on connection or homing","- Alterations to Altmill default profile for Z acceleration","- Enabling rotary mode for grblHAL now disables homing, and disabling rotary mode restores your previous homing value","- Updated Longmill HAL A axis travel resolution for compiled microstepping value","- Main window should no longer be focused on load file dialog"]
59 changes: 33 additions & 26 deletions src/server/controllers/Grblhal/GrblHalController.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class GrblHalController {
actionMask = {
queryParserState: {
state: false, // wait for a message containing the current G-code parser modal state
// the firmware doesn't send ok to the parserstate
reply: false // wait for an `ok` or `error` response
},
queryStatusReport: false,

Expand Down Expand Up @@ -287,14 +287,14 @@ class GrblHalController {
log.debug('Finished Pre-hook');
this.feeder.hold({ data: '%toolchange' });
this.emit('toolchange:preHookComplete', commentString);
return 'G4 P0.5';
return 'G4 P1';
}
if (line === POSTHOOK_COMPLETE) {
log.debug('Finished Post-hook, resuming program');
setTimeout(() => {
this.workflow.resume();
}, 500);
return 'G4 P0.5';
}, 1000);
return 'G4 P1';
}
if (line === PAUSE_START) {
log.debug('Found M0/M1, pausing program');
Expand Down Expand Up @@ -375,12 +375,12 @@ class GrblHalController {
return;
}

// if (this.runner.isAlarm()) {
// this.feeder.reset();
// this.emit('workflow:state', this.workflow.state); // Propogate alarm code to UI
// log.warn('Stopped sending G-code commands in Alarm mode');
// return;
// }
/*if (this.runner.isAlarm()) {
this.feeder.reset();
this.emit('workflow:state', this.workflow.state); // Propogate alarm code to UI
log.warn('Stopped sending G-code commands in Alarm mode');
return;
}*/

line = String(line).trim();
if (line.length === 0) {
Expand All @@ -404,7 +404,7 @@ class GrblHalController {
// Sender
this.sender = new Sender(SP_TYPE_CHAR_COUNTING, {
// Deduct the buffer size to prevent from buffer overrun
bufferSize: (1024 - 28), // TODO: Parse this out from OPT
bufferSize: (1024 - 100), // TODO: Parse this out from OPT
dataFilter: (line, context) => {
// Remove comments that start with a semicolon `;`
let commentMatcher = /\s*;.*/g;
Expand Down Expand Up @@ -482,13 +482,14 @@ class GrblHalController {
this.workflow.pause({ data: 'M6', comment: commentString });

if (toolChangeOption === 'Code') {
this.emit('toolchange:start');
this.runPreChangeHook(commentString);
setTimeout(() => {
this.emit('toolchange:start');
this.runPreChangeHook(commentString);
}, 500);
} else {
const count = this.sender.incrementToolChanges();

setTimeout(() => {
console.log('This is a callback');
// Emit the current state so latest tool info is available
this.runner.setTool(tool?.[2]); // set tool in runner state
this.emit('controller:state', GRBLHAL, this.state, tool?.[2]); // set tool in redux
Expand Down Expand Up @@ -675,6 +676,16 @@ class GrblHalController {
});

this.runner.on('ok', (res) => {
if (this.actionMask.queryParserState.reply) {
if (this.actionMask.replyParserState) {
this.actionMask.replyParserState = false;
this.emit('serialport:read', res.raw);
}
this.actionMask.queryParserState.reply = false;

return;
}

const { hold, sent, received } = this.sender.state;
if (this.workflow.state === WORKFLOW_STATE_RUNNING) {
this.emit('serialport:read', res.raw);
Expand Down Expand Up @@ -866,10 +877,10 @@ class GrblHalController {


this.actionMask.queryParserState.state = false;
this.actionMask.queryParserState.reply = true;

if (this.actionMask.replyParserState) {
this.emit('serialport:read', res.raw);
this.actionMask.replyParserState = false;
}
});

Expand Down Expand Up @@ -1010,18 +1021,18 @@ class GrblHalController {
if (timespan >= toleranceTime) {
log.debug(`Continue parser state query: timespan=${timespan}ms`);
this.actionMask.queryParserState.state = false;
this.actionMask.queryParserState.reply = false;
}
}
} else { // if running, don't send query
return;
}

if (this.actionMask.queryParserState.state) {
if (this.actionMask.queryParserState.state || this.actionMask.queryParserState.reply) {
return;
}

if (this.isOpen()) {
this.actionMask.queryParserState.state = true;
this.actionMask.queryParserState.reply = false;
this.actionTime.queryParserState = now;
this.connection.write(`${GRBLHAL_REALTIME_COMMANDS.GCODE_REPORT}`); // $G equivalent
}
Expand Down Expand Up @@ -1210,6 +1221,7 @@ class GrblHalController {

clearActionValues() {
this.actionMask.queryParserState.state = false;
this.actionMask.queryParserState.reply = false;
this.actionMask.queryStatusReport = false;
this.actionMask.replyParserState = false;
this.actionMask.replyStatusReport = false;
Expand Down Expand Up @@ -1325,7 +1337,7 @@ class GrblHalController {
setTimeout(async () => {
if (this.connection) {
await delay(300);
this.connection.writeImmediate(String.fromCharCode(0x87));
this.connection.writeImmediate(`${String.fromCharCode(0x87)}\n`);
this.connection.write('$I\n');
}
let counter = 3;
Expand Down Expand Up @@ -1607,6 +1619,7 @@ class GrblHalController {
modalGCode.push(setModalGcode);
modalGCode.push('G4 P1');
modalGCode.push('%_GCODE_START');
// console.log(modalGCode);

// Fast forward sender to line
this.sender.setStartLine(lineToStartFrom);
Expand Down Expand Up @@ -2110,7 +2123,6 @@ class GrblHalController {
},
'toolchange:context': () => {
const [context] = args;
console.log(context);
this.toolChangeContext = context;
},
'toolchange:pre': () => {
Expand Down Expand Up @@ -2179,12 +2191,8 @@ class GrblHalController {

const cmd = data.trim();

if (cmd === '$G') { // the command you must manually type for grblHAL gcode report is not $G, but x83
data = '\x83';
}

this.actionMask.replyStatusReport = (cmd === GRBLHAL_REALTIME_COMMANDS.STATUS_REPORT) || (cmd === GRBLHAL_REALTIME_COMMANDS.COMPLETE_REALTIME_REPORT) || this.actionMask.replyStatusReport;
this.actionMask.replyParserState = (cmd === '$G') || this.actionMask.replyParserState;
this.actionMask.replyParserState = (cmd === GRBLHAL_REALTIME_COMMANDS.GCODE_REPORT) || this.actionMask.replyParserState;

this.emit('serialport:write', data, {
...context,
Expand Down Expand Up @@ -2227,7 +2235,6 @@ class GrblHalController {
block.push(...this.convertGcodeToArray(postHook));
block.push(POSTHOOK_COMPLETE);
}
console.log(block);

// If we're not skipping, add a prehook complete to show dialog to continue toolchange operation
if (!skipDialog) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/controllers/Grblhal/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const GRBLHAL_REALTIME_COMMANDS = {
VIRTUAL_STOP_TOGGLE: '\x88',
TOOL_CHANGE_ACK: '\xA3',
ERR_CLEAR: 'ErrClear',
GCODE_REPORT: '\x83',
GCODE_REPORT: '$G\n',
};

// https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9
Expand Down

0 comments on commit 6d2074d

Please sign in to comment.