prusa3d / PrusaSlicer

G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
https://www.prusa3d.com/prusaslicer/
GNU Affero General Public License v3.0
7.79k stars 1.94k forks source link

Coordinate arguments for G92 command are being ignored (again) #7016

Closed DrLex0 closed 3 years ago

DrLex0 commented 3 years ago

Version

2.4.0-alpha2+x64 This issue was not present in alpha1.

Operating system type + version

Mac OS 10.14.6

3D printer brand / version + firmware version (if known)

FlashForge Creator Pro, firmware irrelevant

Behavior

Is this a new feature request? No

Please read my explanation in #3082 again. This printer has its homing position at the rear right corner (actually slightly beyond it). The X axis points to the right and the Y axis points to the rear. So, there is a real valid reason to use nonzero arguments with the G92 command here. If I would shift everything such that the homing position would be (0, 0, 0), all XY print coordinates would become negative, which would be cumbersome and make no sense.

Project File (.3MF) where problem occurs

G92-issue.3mf.zip

bubnikv commented 3 years ago

The issue is different this time.

We optimized the G-code parser. GCodeReader::parse_line_internal() seemingly used to mark an axis as "seen" if it contained no digits, while newly a number is required.

-                char   *pend = nullptr;
-                double  v = strtod(++ c, &pend);
-                if (pend != nullptr && is_end_of_word(*pend)) {
+                double v;
+                auto [pend, ec] = fast_float::from_chars(++ c, end, v);
+                if (pend != c && is_end_of_word(*pend)) {
bubnikv commented 3 years ago

Thus the reader now fails to process GCodeProcessor::process_M132()

bubnikv commented 3 years ago

Fixed in PrusaSlicer 2.4.0-alpha3.