(bug) Skipped (or ignored) GCode commands in gcode file
-
Summary: The duet sometimes skips or ignores commands to wait for a tool to heat up.
This one is kind of odd to explain, and I'm
notpretty sure if I've narrowed down the exact circumstances to repeat it. The problem occurs often enough, it's just that I haven't had the time to 100% pin down the circumstances it occurs under. (Edit: I'm now 99% certain of the steps to repeat at least on my setup.)I'm using a Duet Ethernet and firmware 1.20.1RC2.
My startup script (seen below) is fairly well commented. What it's supposed to do is home the machine, turn on the HBP heater, then move to the rear right of my build plate to wait until everything is heated and then displays a message until the HBP is up to temp. After the HBP is up to temp, it clears that first message and starts to heat the tool heater - and displays a second message while waiting for the tool to heat up. Finally, once everything is up to the proper temperature, it will clear the second message, display a third message, do a "purge and wipe", clear the third message, and then start the actual print.
What I've found is the sometimes I'll start a print and immediately after the printer homes itself, I'll see that third (purge and wipe) message (without seeing the first two messages and without the tool heater being heated.) It's not a cosmetic thing, because the printer is actually running the G1 commands to perform the "purge and wipe." Of course, the nozzle is usually cold when this happens, so the firmware prevents any extrusion and nothing actually happens besides the nozzle moving all over the build plate. (Usually when this happens, I just pause and cancel - which turns off heaters - and everything works when I restart the print.)
I THINK I've narrowed the issue down to only happen when the HBP is already at the required print temperature when the gcode print is started. In other words, if I preheat my HBP before starting the print and I preheat it to the same temperature specified in the startup script (105 for ABS), it skips waiting for the print tool to heat up and the first thing I see is the message about purging and wiping (and the tool is often still at room temperature.) In the gcode shown below, it seems as if the "M116 P1" command is skipped, ignored (or perhaps being parsed improperly?)
Once I deliberately preheated my HBP to 3 degrees cooler than the the 105 I typically use for ABS, and everything worked. It changed the target temp for the HBP to 105, displayed a message, and when the build plate got to almost 105, it displayed the message for the tool and started heating that… (and waited for it to heat up before continuing.)
As promised, here's the actual gcode from one of my print files that includes the 3 gcode commands that S3D inserts followed by my script:
[[language]] G90 M83 M106 S0 ; S3D starting gcode for RIGHT extruder ; M140 S105 ; start heating the bed (no wait) while homing G28 ; homeall T1 ; load right tool G1 X150 Y70 Z30 F6000 ; move to wait position right hand side of table M291 P"Heating Build Plate" S1 T6000 M190 S105 ; now wait for the bed to finish heating M292 M300 S600 P600 ; make some noise G10 P0 S0 ; set T0 temp G10 P1 S232 ; set T1 temp M291 P"Heating Tool" S1 T6000 M116 P1 ; wait for right tool to heat up M292 M300 S600 P600 ; make some noise M291 P"Purging and Wiping Right Nozzle" S1 T5 G1 Z0.4 ; position nozzle G1 X110 Y70 E25 F300 ; purge nozzle G1 X120 Y70 Z0.15 F1200 ; slow wipe G1 X110 Y70 Z0.5 F1200 ; lift M400 ; wait the purge/wipe M292 ; clear the purge/wipe message
-
With more testing, my rate of repeat on this is 100% and it doesn't matter if the used tool is T0 or T1. I've had it repeat twice this evening, both times with a similar startup, but using 90 as the temp for the HBP, and trying to heat T0 instead of T1
-
So are you saying that doing M116 P1 when tool 1 is active doesn't wait for tool 1 to reach active temperature, if the bed is already up to temperature?
-
It seems to be the combination of the following commands - in this case, IF (and only if) the bed heater is already heated to the target temperature when the initial M140 call is made, then the M116 at the end doesn't block to wait for the tool to heat up.
It's odd. If, in the sequence below, the bed is at 100C when I start, it all works. If the bed is at 105 (or "close enough") then it just goes right past everything including the m116 at the end (regardless of the tool temp.) Yet, I can repeat it over and over. I tried to enable logging (m929 I think) but it was completely useless.
M140 S105 ; start heating the bed (no wait) while homing
G28 ; homeall
T1 ; load right tool
M190 S105 ; now wait for the bed to finish heating
G10 P0 S0 ; set T0 temp
G10 P1 S232 ; set T1 temp
M116 P1I've had the same thing happen with tool 0 (making the adjustments in the above script - they are just replaceable params in S3D startup scripts.)
Is there some type of debugging I can enable that might help? The event log (m929, I think) was useless.
-
So are you saying that doing M116 P1 when tool 1 is active doesn't wait for tool 1 to reach active temperature, if the bed is already up to temperature?
To directly answer, "yes." At least in the sequence of commands shown.
-
I just tried a variation of the above gcode to see if it would make a difference. Instead of using M140 to start heating the HBP and then using M190 to wait for the bed to finish heating, I instead used M140 to start the heating, and "M116 H0" to wait for it to finish. (The actual gcode is below.)
The end result was exactly the same. If the build plate is already at the desired temperature, the firmware doesn't wait for the (extruder) tool to heat up and immediately continues past to the "purge and wipe" part. (On the other hand, if the HBP is not yet at the desired temp, everything works fine.)
Here's the revised (but still failing) gcode (note that this is using T0 while previous examples used T1):
[[language]] G90 M83 M106 S0 ; S3D starting gcode for LEFT extruders ; M140 S105 ; start heating the bed (no wait) while homing G28 ; homeall T0 ; load left tool G1 X-145 Y-70 Z30 F6000 ; move to wait position left hand side of table M291 P"Heating Build Plate" S1 T6000 ;M190 S105 ; now wait for the bed to finish heating M116 H0 ; alternate way to wait for the bed to finish heating M292 M300 S600 P600 ; make some noise G10 P0 S240 ; set T1 temp G10 P1 S0 ; set T1 temp M291 P"Heating Tool" S1 T6000 M116 P0 ; wait for T0 to get to the designated temp M292 M300 S600 P600 ; make some noise M291 P"Purging and Wiping Left Nozzle" S1 T5 G1 Z0.4 ; Position nozzle G1 X-105 Y-70 E25 F300 ; purge nozzle G1 X-115 Y-70 Z0.15 F1200 ; slow wipe in reverse G1 X-100 Y-70 Z0.5 F1200 ; lift across wipe area M400 M292
-
I tried another variation (and the issue still occurred.) Thinking that perhaps something in my homeall.g macro might have been causing a problem, or perhaps selecting the tool was causing a problem, I moved both commands to occur before the initial heating of the HBP. That did not resolve the problem. The "M116 P0" command still did NOT wait for the extruder tool to heat up. Here's the "new" gcode snippet:
[[language]] G90 M83 M106 S0 ; S3D starting gcode for LEFT extruders ; G28 ; homeall T0 ; load left tool M140 S105 ; start heating the bed (no wait) while homing G1 X-145 Y-70 Z30 F6000 ; move to wait position left hand side of table M291 P"Heating Build Plate" S1 T6000 ;M190 S105 ; now wait for the bed to finish heating M116 H0 ; alternate way to wait for the bed to finish heating M292 M300 S600 P600 ; make some noise G10 P0 S240 ; set T1 temp G10 P1 S0 ; set T1 temp M291 P"Heating Tool" S1 T6000 M116 P0 ; wait for everything to get to the designated temp M292 M300 S600 P600 ; make some noise M291 P"Purging and Wiping Left Nozzle" S1 T5 G1 Z0.4 ; Position nozzle G1 X-105 Y-70 E25 F300 ; purge nozzle G1 X-115 Y-70 Z0.15 F1200 ; slow wipe in reverse G1 X-100 Y-70 Z0.5 F1200 ; lift across wipe area