j7126 / OctoPrint-Dashboard

A dashboard for Octoprint
GNU Affero General Public License v3.0
288 stars 39 forks source link

Layercount doubled using CANVAS (canvad3d.io) slicer from Mosaic #319

Closed unclej84 closed 2 years ago

unclej84 commented 3 years ago

Describe the bug Apparently CANVAS writes 2 triggering layer indicators per layer. So the dashboard shows doubled layer numbers for current and total layer as well as strange average layer durations (both entries are directly after each other so that one layer is the real layer time and the other one is nearly 0).

These trigger for Simplify3d and the generic slicer dict.

The relevant gcode entries are:

The later one is custom gcode for layer change and could be removed in the setting but is IMO the more common one to find and also used in other plugins.

I know that this is a bit long but please take your time and fill in the following information as clearly and detailed as possible. It will shorten the time needed to understand and fix the issue significantly. Please also state versions clearly when applicable. "Latest version" doesn't help much.

Expected behavior Only one dictionary should trigger for the whole file. Maybe it would be possible to check the file first for the best matching dict (e.g. with if (len([*re.finditer(pattern, text)]) > 0)) and then just use this dict for the whole file instead of running thru all dicts on every line to find the first match.

Screenshots Screenshot 2021-11-25 184041

Sample: 000014_Ender-3 Pro_Thread_Z-Axis-Knob.zip

j7126 commented 2 years ago

I have made it store the beginning of the first layer indicator that is matched, and only match future layer indicators that start with that. Hopefully this should fix the issue.

This change will be included in the next release, you can try it out by installing the version from development branch https://github.com/j7126/OctoPrint-Dashboard/archive/development.zip

mpaw commented 2 years ago

@j7126 Is this fix going to be released soon?