M500 after PID autotune overwrites G31 in config-override.g
-
Hello everyone
I have encountered a problem (likely I am doing something wrong) where a present G31 command in config-override.g that defines the Z-offset is being overwritten when I run M500 after a PID autotune procedure.
Board: Duet 3 Mini 5+
RRF: 3.3
DWC: 3.3
PanelDue: 3.3I am auto-saving a calibrated Z-offset in config-override.g which works perfect.
If I then run a PID autotune and save the result via M500 to config-override.g, my Z-offset is being deleted and "Probed tool offsets being added".
Before the PID tuning:
; config-override.g file generated in response to M500 at 2021-08-25 21:02 ; This is a system-generated file - do not edit ; Heater model parameters M307 H0 R0.265 C501.956:501.956 D9.70 S1.00 V24.2 B0 I0 M307 H1 R4.542 C84.643:84.643 D2.59 S1.00 V24.3 B0 I0 ; Z probe parameters G31 K0 P1000 X23.0 Y5.0 Z1.30 ; Workplace coordinates G10 L2 P1 X0.00 Y0.00 Z0.00 G10 L2 P2 X0.00 Y0.00 Z0.00 G10 L2 P3 X0.00 Y0.00 Z0.00 G10 L2 P4 X0.00 Y0.00 Z0.00 G10 L2 P5 X0.00 Y0.00 Z0.00 G10 L2 P6 X0.00 Y0.00 Z0.00 G10 L2 P7 X0.00 Y0.00 Z0.00 G10 L2 P8 X0.00 Y0.00 Z0.00 G10 L2 P9 X0.00 Y0.00 Z0.00
After saving the PID values via M500:
; config-override.g file generated in response to M500 at 2021-08-25 21:02 ; This is a system-generated file - do not edit ; Heater model parameters M307 H0 R0.265 C501.956:501.956 D9.70 S1.00 V24.2 B0 I0 M307 H1 R4.542 C84.643:84.643 D2.59 S1.00 V24.3 B0 I0 ; Probed tool offsets G10 P0 X0.00 Y0.00 Z0.00 ; Workplace coordinates G10 L2 P1 X0.00 Y0.00 Z0.00 G10 L2 P2 X0.00 Y0.00 Z0.00 G10 L2 P3 X0.00 Y0.00 Z0.00 G10 L2 P4 X0.00 Y0.00 Z0.00 G10 L2 P5 X0.00 Y0.00 Z0.00 G10 L2 P6 X0.00 Y0.00 Z0.00 G10 L2 P7 X0.00 Y0.00 Z0.00 G10 L2 P8 X0.00 Y0.00 Z0.00 G10 L2 P9 X0.00 Y0.00 Z0.00
Can someone help me understand what I am doing wrong?
config-override.g is important to us as we will store the printer unique values (like Z-offsets) there to make those independent from any config.g we publish for our users. Once we publish a new configuration users can upload it without their custom values which are unique to their printer being touched.
For the Z-offset we use a macro that lets the user calibrate the first layer with a print and then save the resulting offset to config-override.g. This avoids that users have to touch configuration files and only need to interact with either DWC or the PanelDue to calibrate their first layer.
Users will also be able to use babystepping during the first layer of any print and the adjustments made are automatically added/substracted to the current Z-offset and then again saved to config-override.g
Due to the above use cases I hope there is an easy solution that prevents the overwriting of G31 in config-override.g
Thanks in advance!
-
-
@fcwilt Thanks for the quick reply!
So this means I would need to include P31 for G31 to remain in config-override.g? I looked at the docs but definitely did not properly understand the explanation for M500 in this case
Let me try this and report back.
-
Are you manually editing config-override.g to add the G31 offset or are you saving it with M500 P31?
-
@phaedrux I am saving it via M500 P10:31
Here is the macro:
; layer_change.g ; system file, called on first layer change during a print from Prusaslicer to save applied babysteps to config-override.g ; requires modifications to layer change G-Code in Prusaslicer if move.axes[2].babystep !=0 ; if no babysteps are currently adjusted - exit routine echo {"OLD: " ^ sensors.probes[0].triggerHeight ^ " NEW: " ^ sensors.probes[0].triggerHeight + (move.axes[2].babystep * -1)} ; displays old and new Z probe trigger height G31 Z{sensors.probes[0].triggerHeight - move.axes[2].babystep} ; measures and applies new Z probe trigger height M500 P10:31 ; saves new Z probe trigger height to config-overide.g
This is executed during our initial Calibration Wizard and on any print from Prusaslicer after the first layer to save further adjustments made after initial calibration.
-
Will have to check with DC42 on whether this is the expected behaviour of M500.
-
The comment about changing the layer change G-Code in PrusaSlicer - what change do you make?
How are you keeping the "macro" from updating config_override.g on every layer change?
Frederick
-
@phaedrux I just tried with using M500 P31 to save the PID values and it worked just fine. G31 is no longer being overwritten.
As we use a macro for PID tuning is well I can simply store via M500 P31 and the problem should be solved.
Of course we cannot prevent users to run PID autotune outside our macro which then could be a potential issue. For now I think it should be OK though.
-
@fcwilt thanks for your tip!
Here is what I use in the "before layer change gcode" in Prusaslicer:
G92 E0.0 ; reset extruder position to 0 {if layer_z == layer_height+first_layer_height}M98 P"layer_change.g"{endif} ; execute layer_change.g ;[layer_z]
This only executes the macro on layer change from layer 1 to 2.
-
@flobler said in M500 after PID autotune overwrites G31 in config-override.g:
@fcwilt thanks for your tip!
Here is what I use in the "before layer change gcode" in Prusaslicer:
G92 E0.0 ; reset extruder position to 0 {if layer_z == layer_height+first_layer_height}M98 P"layer_change.g"{endif} ; execute layer_change.g ;[layer_z]
This only executes the macro on layer change from layer 1 to 2.
Thanks.
If for some reason in the future you would need to run code on other layer changes it would be easy using a RRF global variable to make the "first layer" test in your macro and simply have M98 P"layer_change.g" in the slicer.
This would also have the minor benefit of keeping all of your code together in your macro.
Frederick
-
@fcwilt That's a great point, thank you!
-
@phaedrux said in M500 after PID autotune overwrites G31 in config-override.g:
Will have to check with DC42 on whether this is the expected behaviour of M500.
What should be happening is:
- Once you save using M500 P31 then assuming you have one or more Z probes defined, a G31 line or lines will be written to config-override.g
- If you have M501 in config.g then that G31 command will be read at boot time and the "save G31 settings with M500 automatically" flag will be set. So subsequently, sending M500 without the P31 parameter will include saving G31 settings.
- If you delete config-override.g or you manually edit out the G31 lines from config-override.g and then reboot, M500 will no longer write the G31 settings unless you specify the P31 parameter.
-
see my post here:
https://forum.duet3d.com/topic/24830/config-override-parameters-gets-lost-after-saving/4
Looks like the same issue
-
@cr3d this is now fixed in the 3.4 source code.
-
@dc42 ok perfect
When will it be released... we have to pack an idex machine on the weekend and that should also be included ...
-
@cr3d I can provide an internal build for you to test with. Would that help? Which Duet do you have?
-
@dc42 Ok ... better than nothing
At this printer there is a Duet 2 Wifi EA + Duex 5
-
@cr3d the current internal build is at https://www.dropbox.com/sh/qkexrvhgsebbz0g/AAD9gfyS8UIU5Sau311WS1oLa?dl=0.
-
Quick answer -> now it works!
We can use M500 / M500 P10 / M500 P31 / M500 P10:31 and nothing gets deleted
Thank you!
-
Great, thanks everyone for the help! Looking forward to the fix!