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

add get_current_line_number as default action for gcode M110 without N parameter #27090

Merged
merged 6 commits into from
May 20, 2024

Conversation

ellensp
Copy link
Contributor

@ellensp ellensp commented May 14, 2024

Description

While looking around at how marlin handles gcode with line numbers and checksum I noticed there was no way to see the current line number.

M110 N#### sets the line number, but M110 on its own does nothing
This PR changes M110 on its own to emit the current line number

eg send: M110
receive: echo: M110 N0

This adds a whole 6 bytes flash on Avr based machines, so I concluded that having a define to remove this new feature was probably not needed.

Requirements

None

Benefits

More constant gcode behavior (gcode without parameters tend to return the current settings for that gcode)

@ellensp ellensp changed the title add get_current_line_number as deffault action for gcode M110 without N parameter add get_current_line_number as default action for gcode M110 without N parameter May 14, 2024
@thinkyhead
Copy link
Member

thinkyhead commented May 20, 2024

The G-code line number is somewhat arbitrary, as it isn't the line in the G-code file, but just the line of commands that have been sent, potentially with comments and other stuff stripped out. I can see this being useful for debugging, but is there some host protocol that would need to get the line number of the last command that was received and enqueued just before the M110 command?

Note that the host is most likely to have already sent additional complete enqueued commands and command bytes that are yet to be enqueued at the time when the M110 (sent as a user command) processed in the queue. (Note that M110 is not a super-command like M112 and is processed in the regular queue order).

@thinkyhead
Copy link
Member

Tweaked this to make it a real "protocol" feature, and added a note to remind us that this is related to M999.

@thisiskeithb
Copy link
Member

Don't forget to update the M110 - Set Line Number page 😃

thinkyhead added a commit to MarlinFirmware/MarlinDocumentation that referenced this pull request May 20, 2024
@thinkyhead thinkyhead merged commit 5561baf into MarlinFirmware:bugfix-2.1.x May 20, 2024
62 checks passed
@ellensp ellensp deleted the extend-M110 branch May 20, 2024 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants