Hello,
I have been experiencing this issue for awhile but have been able to narrow down my issue recently. My issue occurs when cancelling a print, or a print cancelling itself (such as forgetting an R parameter on an arc move) during a while loop. Once that happens, I can no longer print that file again even if I edit it. It gives me the reply that the variable is no longer existent. I replicated the issue using this code:
M207 P2 Z2 F4000 S30 R10 T2000
var parts = 4
while iterations < var.parts
G1 X9.0402 Y0.0
G1 Z2.0 F2000
;G11
G3 X6.39236 Y6.39236 Z2.5 F600 r9.0402
G3 X0.0 Y9.0402 Z2.5 r9.0402
G3 X-6.39236 Y6.39236 Z2.5 r9.0402
G3 X-9.0402 Y0.0 Z2.5 r9.0402
G3 X-6.39236 Y-6.39236 Z2.5 r9.0402
G3 X0.0 Y-9.0402 Z2.5 r9.0402
G3 X6.39236 Y-6.39236 Z2.5 r9.0402
G3 X9.0402 Y0.0 Z3.0 r9.0402
G3 X6.39236 Y6.39236 Z3.0 r9.0402
G3 X0.0 Y9.0402 Z3.0 r9.0402
G3 X-6.39236 Y6.39236 Z3.0 r9.0402
G3 X-9.0402 Y0.0 Z3.0 r9.0402
;G10
G4 S1
M98 P"0:/macros/Project Macros/PS/Next Part"
M0
I run the above code and cancel the print during the while loop. I then tried to run the file again after editing a line and received the error message that "parts" is already declared or non existent. This is my console log when I replicated the issue:
4/26/2023, 7:44:41 AM M32 "0:/gcodes/C3DM/loop-failure.gcode"
File 0:/gcodes/C3DM/loop-failure.gcode selected for printing Error: in GCode file line 6 column 29: meta command: unknown variable 'parts' Cancelled printing file 0:/gcodes/C3DM/loop-failure.gcode, print time was 0h 0m
4/26/2023, 7:44:27 AM Upload of loop-failure.gcode successful after 4s
4/26/2023, 7:43:54 AM M0
Cancelled printing file 0:/gcodes/C3DM/loop-failure.gcode, print time was 0h 0m
4/26/2023, 7:43:45 AM M25
Resume state saved Printing paused at X300.2 Y105.3 Z55.0
4/26/2023, 7:43:20 AM M32 "0:/gcodes/C3DM/loop-failure.gcode"
File 0:/gcodes/C3DM/loop-failure.gcode selected for printing
I am able to print the file again if I upload the file again as a different name. It also allows me to print the file again if I rename the file. The only other way I have been able to reprint the files is to send M999 to reset the board.
When there are multiple variables, the issue also affects those as well. It only affects local variables. This issue does not happen if I let the loop finish executing before cancelling the print. I have experienced this issue on every Duet board I have used. I believe that this is a bug.
Let me know if I can provide more information. Thanks