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

    using a macro for the G31 command?

    Scheduled Pinned Locked Moved
    Using Duet Controllers
    4
    6
    366
    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.
    • axiomundefined
      axiom
      last edited by

      Is there a way to set the z-offset position in g-config and config.g.bak to 0 at the same time using a macro for the G31 command? So far I have to open config.g and set the offset to 0 every time and then open config.g.bak and set the offset to 0 there...I find that cumbersome

      OwenDundefined Phaedruxundefined 2 Replies Last reply Reply Quote 0
      • OwenDundefined
        OwenD @axiom
        last edited by OwenD

        @axiom
        I think you might mean config-override.g rather than config.g.bak

        If you have a config-override.g and you have M501 at the end of config.g then there's no need to edit config.g

        In your macro, just set your offsets using G31 then call M500 P31 to save it to config-override.g

        e.g

        G31 X0 Y0
        M500 P31
        
        

        On restart, whatever is in the override file will replace what was set in config.g

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

          @axiom said in using a macro for the G31 command?:

          set the offset to 0 every time

          It should be set once and it won't change.

          Are you sending M500 P31 at some point to save a different G31 value to config-override.g?

          Or are you saying that your config.g isn't saving when you edit it? How are you editing it?

          Z-Bot CoreXY Build | Thingiverse Profile

          axiomundefined 1 Reply Last reply Reply Quote 0
          • axiomundefined
            axiom @Phaedrux
            last edited by

            @Phaedrux If I want to reset my z-offset, do I first have to set the existing offset to zero in config.g? Then I follow the routine from the documentation...after that I enter my result from the G30 S-1 for the z-offset in the config.g. Although I have M501 at the end, I have to enter the value in confi-override.g every time, otherwise my offset will not be accepted. I find that very difficult. Can't you simplify this whole routine? Here is my config.g code:

            ; Configuration file for Duet WiFi (firmware version 3.3)
            ; executed by the firmware on start-up
            ;
            ; generated by RepRapFirmware Configuration Tool v3.3.16 on Sun May 28 2023 15:23:44 GMT+0200 (Mitteleuropäische Sommerzeit)

            ; General preferences
            M575 P1 S1 B57600 ; enable support for PanelDue
            G90 ; send absolute coordinates...
            M83 ; ...but relative extruder moves
            M550 P"DUKA Axiom" ; set printer name

            ; Network
            M552 S1 ; enable network
            M586 P0 S1 ; enable HTTP
            M586 P1 S1 ; enable FTP
            M586 P2 S1 ; enable Telnet

            ; Drives
            M569 P0 S1 ; physical drive 0 goes forwards
            M569 P1 S1 ; physical drive 1 goes forwards
            M569 P2 S1 ; physical drive 2 goes forwards
            M569 P3 S1 ; physical drive 3 goes forwards
            M584 X0 Y1 Z2 E3 ; set drive mapping
            M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
            ;M92 X80.00 Y80.00 Z400.00 E420.00 ; set steps per mm
            M92 X80.00 Y80.00 Z640.00 E322.58 ; set steps per mm
            ;M566 X900.00 Y900.00 Z60.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
            M566 X900.00 Y900.00 Z100.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
            ;M203 X6000.00 Y6000.00 Z180.00 E1200.00 ; set maximum speeds (mm/min)
            M203 X6000.00 Y6000.00 Z300.00 E1200.00 ; set maximum speeds (mm/min)
            ;M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2)
            M201 X500.00 Y500.00 Z40.00 E250.00 ; set accelerations (mm/s^2)
            M906 X2500 Y1600 Z1800 E1600 I30 ; set motor currents (mA) and motor idle factor in per cent
            M84 S30 ; Set idle timeout

            ; Axis Limits
            M208 X0 Y0 Z0 S1 ; set axis minima
            M208 X750 Y638 Z1255 S0 ; set axis maxima

            ; Endstops
            M574 X1 S1 P"xstop" ; configure switch-type (e.g. microswitch) endstop for low end on X via pin xstop
            M574 Y1 S1 P"ystop" ; configure switch-type (e.g. microswitch) endstop for low end on Y via pin ystop
            ;M574 Z2 S1 P"zstop" ; configure switch-type (e.g. microswitch) endstop for high end on Z via pin zstop
            ;M574 Z2 S2 ; configure Z-probe endstop for high end on Z

            ; Z-Probe
            M558 P1 C"!zprobe.in" H5 F120 T6000 ; set Z probe type to unmodulated and the dive height + speeds
            G31 P1000 X-1 Y-61 Z2 ; set Z probe trigger value, offset and trigger height
            M557 X0:700 Y-27:577 S40 ; define mesh grid

            ; Heaters

            ; Bed
            M308 S0 P"bedtemp" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin bedtemp
            M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0
            ;M307 H0 B1 S1.00 ; enable bang-bang mode for the bed heater and set PWM limit
            M307 H2 R0.283 K0.463:0.000 D7.17 E1.35 S1.00 B0 ; enable bang-bang mode for the bed heater and set PWM limit
            M140 H0 ; map heated bed to heater 0
            M143 H0 S280 ; set temperature limit for heater 0 to 120C

            ;Hotend
            M308 S1 P"e0temp" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin e0temp
            M950 H1 C"e0heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1
            ;M307 H1 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit
            M307 H1 R1.797 K0.742:0.000 D7.57 E1.35 S1.00 B0 V23.8 ; disable bang-bang mode for heater and set PWM limit
            M143 H1 S400 ; set temperature limit for heater 1 to 400C

            ; Fans
            M950 F0 C"fan0" Q600 ; create fan 0 on pin fan0 and set its frequency
            M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned off
            M950 F1 C"fan1" Q700 ; create fan 1 on pin fan1 and set its frequency
            M106 P1 S1 H1 T60 ; set fan 1 value. Thermostatic control is turned on
            M950 F2 C"fan2" Q500 ; create fan 2 on pin fan2 and set its frequency
            M106 P2 S1 H1 T50 ; set fan 2 value. Thermostatic control is turned on

            ; Tools
            ;M563 P1 S"Druckkopf 1" H1 F0 ; define tool 1
            M563 P0 D0 H1 F0 ; define tool 1
            G10 P0 X0 Y0 Z0 ; set tool 1 axis offsets
            G10 P0 R0 S0 ; set initial tool 1 active and standby temperatures to 0C
            M591 D0 P1 C"e1-stop" S0 ;R40:120 E3.0 S1 Filament Sensor
            ; Custom settings are not defined
            M501

            DIY-O-Sphereundefined Phaedruxundefined 2 Replies Last reply Reply Quote 0
            • DIY-O-Sphereundefined
              DIY-O-Sphere @axiom
              last edited by DIY-O-Sphere

              @axiom said in using a macro for the G31 command?:

              Although I have M501 at the end

              If you would like to have the paramaters saved to the config-override automatically check the M500 command.
              M501 only tells the firmware to read the config-override at the end of the boot process.
              So all of the parameters that are redundant will be set to the last read values.
              In your case the config-override.

              If you remove the parameter entry from config-override the config is used......

              I personally avoid using the override function. It is easier for me to have all the parameters in one place. It also makes support more difficult.

              (UTC+1)

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

                @axiom said in using a macro for the G31 command?:

                Can't you simplify this whole routine?

                Yes, you don't need to even measure the offset at all if you're using manual probing because the offset is 0. It's only needed when using a probe that isn't the nozzle tip.

                You can delete the line from your config-override.g if it exists. It only gets written there if you send M500 P31 specifically.

                Z-Bot CoreXY Build | Thingiverse Profile

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