kantlivelong / OctoPrint-SmartPreheat

GNU Affero General Public License v3.0
24 stars 6 forks source link

g-code parsing fixes & logging enhancements #2

Closed dlitz closed 4 years ago

dlitz commented 4 years ago

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?

Any background context you want to provide?

What are the relevant tickets if any?

Screenshots (if appropriate)

Further notes

kantlivelong commented 4 years ago

Changes look good :+1:. Once I test it out I'll merge. Thanks!

dlitz commented 4 years ago

Rebased onto master and fixed authorship info.

kantlivelong commented 4 years ago

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

Thanks! :+1: