Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    M500 after PID autotune overwrites G31 in config-override.g

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    5
    20
    953
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • floblerundefined
      flobler
      last edited by flobler

      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.3

      I 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!

      fcwiltundefined 1 Reply Last reply Reply Quote 0
      • fcwiltundefined
        fcwilt @flobler
        last edited by

        @flobler

        M500 Documentation

        Note the P31 parameter. Are you including that?

        Frederick

        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

        floblerundefined 1 Reply Last reply Reply Quote 1
        • floblerundefined
          flobler @fcwilt
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • Phaedruxundefined
            Phaedrux Moderator
            last edited by

            Are you manually editing config-override.g to add the G31 offset or are you saving it with M500 P31?

            Z-Bot CoreXY Build | Thingiverse Profile

            floblerundefined 1 Reply Last reply Reply Quote 0
            • floblerundefined
              flobler @Phaedrux
              last edited by flobler

              @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.

              fcwiltundefined 1 Reply Last reply Reply Quote 0
              • Phaedruxundefined
                Phaedrux Moderator
                last edited by

                Will have to check with DC42 on whether this is the expected behaviour of M500.

                Z-Bot CoreXY Build | Thingiverse Profile

                floblerundefined dc42undefined 2 Replies Last reply Reply Quote 0
                • fcwiltundefined
                  fcwilt @flobler
                  last edited by fcwilt

                  @flobler

                  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

                  Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                  floblerundefined 1 Reply Last reply Reply Quote 0
                  • floblerundefined
                    flobler @Phaedrux
                    last edited by flobler

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • floblerundefined
                      flobler @fcwilt
                      last edited by

                      @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.

                      fcwiltundefined 1 Reply Last reply Reply Quote 0
                      • fcwiltundefined
                        fcwilt @flobler
                        last edited by fcwilt

                        @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

                        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                        floblerundefined 1 Reply Last reply Reply Quote 0
                        • floblerundefined
                          flobler @fcwilt
                          last edited by

                          @fcwilt That's a great point, thank you!

                          1 Reply Last reply Reply Quote 0
                          • dc42undefined
                            dc42 administrators @Phaedrux
                            last edited by dc42

                            @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.

                            Duet WiFi hardware designer and firmware engineer
                            Please do not ask me for Duet support via PM or email, use the forum
                            http://www.escher3d.com, https://miscsolutions.wordpress.com

                            CR3Dundefined 1 Reply Last reply Reply Quote 2
                            • CR3Dundefined
                              CR3D @dc42
                              last edited by

                              @dc42

                              see my post here:

                              https://forum.duet3d.com/topic/24830/config-override-parameters-gets-lost-after-saving/4

                              Looks like the same issue

                              Christian from CR-3D
                              Homepage:
                              www.cr-3d.de

                              Facebook:
                              https://www.facebook.com/cr3d.official

                              Our Discord Server
                              https://discord.gg/SxRaPNuRdA

                              Thingiverse Profile:
                              https://www.thingiverse.com/cr-3d_official/about

                              dc42undefined 1 Reply Last reply Reply Quote 0
                              • dc42undefined
                                dc42 administrators @CR3D
                                last edited by

                                @cr3d this is now fixed in the 3.4 source code.

                                Duet WiFi hardware designer and firmware engineer
                                Please do not ask me for Duet support via PM or email, use the forum
                                http://www.escher3d.com, https://miscsolutions.wordpress.com

                                CR3Dundefined 1 Reply Last reply Reply Quote 0
                                • CR3Dundefined
                                  CR3D @dc42
                                  last edited by

                                  @dc42 ok perfect 🙂

                                  When will it be released... we have to pack an idex machine on the weekend and that should also be included ... 😉

                                  Christian from CR-3D
                                  Homepage:
                                  www.cr-3d.de

                                  Facebook:
                                  https://www.facebook.com/cr3d.official

                                  Our Discord Server
                                  https://discord.gg/SxRaPNuRdA

                                  Thingiverse Profile:
                                  https://www.thingiverse.com/cr-3d_official/about

                                  dc42undefined 1 Reply Last reply Reply Quote 0
                                  • dc42undefined
                                    dc42 administrators @CR3D
                                    last edited by dc42

                                    @cr3d I can provide an internal build for you to test with. Would that help? Which Duet do you have?

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    CR3Dundefined 1 Reply Last reply Reply Quote 0
                                    • CR3Dundefined
                                      CR3D @dc42
                                      last edited by

                                      @dc42 Ok ... better than nothing 🙂

                                      At this printer there is a Duet 2 Wifi EA + Duex 5

                                      Christian from CR-3D
                                      Homepage:
                                      www.cr-3d.de

                                      Facebook:
                                      https://www.facebook.com/cr3d.official

                                      Our Discord Server
                                      https://discord.gg/SxRaPNuRdA

                                      Thingiverse Profile:
                                      https://www.thingiverse.com/cr-3d_official/about

                                      dc42undefined 1 Reply Last reply Reply Quote 0
                                      • dc42undefined
                                        dc42 administrators @CR3D
                                        last edited by

                                        @cr3d the current internal build is at https://www.dropbox.com/sh/qkexrvhgsebbz0g/AAD9gfyS8UIU5Sau311WS1oLa?dl=0.

                                        Duet WiFi hardware designer and firmware engineer
                                        Please do not ask me for Duet support via PM or email, use the forum
                                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                                        CR3Dundefined 1 Reply Last reply Reply Quote 0
                                        • CR3Dundefined
                                          CR3D @dc42
                                          last edited by

                                          @dc42

                                          Quick answer -> now it works!

                                          We can use M500 / M500 P10 / M500 P31 / M500 P10:31 and nothing gets deleted 🙂

                                          Thank you!

                                          Christian from CR-3D
                                          Homepage:
                                          www.cr-3d.de

                                          Facebook:
                                          https://www.facebook.com/cr3d.official

                                          Our Discord Server
                                          https://discord.gg/SxRaPNuRdA

                                          Thingiverse Profile:
                                          https://www.thingiverse.com/cr-3d_official/about

                                          1 Reply Last reply Reply Quote 1
                                          • floblerundefined
                                            flobler
                                            last edited by

                                            Great, thanks everyone for the help! Looking forward to the fix!

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA