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

g-code parsing fixes & logging enhancements #2

Merged
merged 4 commits into from
May 5, 2020

Conversation

dlitz
Copy link
Contributor

@dlitz dlitz commented May 2, 2020

What does this PR do and why is it necessary?

This basically fixes two problems that I had with the plugin:

  1. Temperatures got detected incorrectly as 0 because the plugin was parsing everything through to the end of the file, instead of stopping at the first extrusion. This occurs because Cura emits lines like G1 X37.944 Y45.731 E0.18608, and the parser would only recognize G1 commands with the E parameter listed first, e.g. G1 E0.18608 X37.944 Y45.731.

  2. The plugin would erroneously recognize any command with a T parameter as a tool-select command, including commands there the T parameter is unrelated to toolhead selection. For example, it was setting the tool number to 500 upon reading this line:
    M204 P500 R5000 T500 ;Setup Print/Retract/Travel acceleration

This also makes some small improvements to debug logging.

How was it tested? How can it be tested by the reviewer?

  • Printed on my 3D printer. After applying these changes and updating the gcode templates in OctoPrint, temperatures were set correctly in the smartPreheat snippet.
  • Here's the gcode file that I used for testing with my printer. I make no guarantee that it will print correctly on anyone's hardware but my own (a CR-20 running a custom version of Marlin).

Any background context you want to provide?

What are the relevant tickets if any?

Screenshots (if appropriate)

Further notes

@kantlivelong
Copy link
Owner

Changes look good 👍. Once I test it out I'll merge. Thanks!

dlitz added 4 commits May 3, 2020 06:54
…r own.

This fixes first-extrusion detection for gcode emitted by Cura, which
emits lines like 'G1 X40.417 Y112.921 E1487.23414' (previously, E needed
to be the first parameter after G1).
Previously, any command with a T parameter (e.g. "M204 P500 R5000 T500")
would match and confuse the plugin.
@dlitz
Copy link
Contributor Author

dlitz commented May 3, 2020

Rebased onto master and fixed authorship info.

@kantlivelong kantlivelong merged commit e293b63 into kantlivelong:master May 5, 2020
@kantlivelong
Copy link
Owner

I really dropped the ball on that parser. Have been using it here for over a year but never noticed these issues.

Thanks! 👍

@kantlivelong kantlivelong mentioned this pull request May 5, 2020
5 tasks
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.

2 participants