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

    CNC Pause and Resume config files

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    44
    1.7k
    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.
    • Nightowlundefined
      Nightowl @OwenD
      last edited by

      @owend Doing that now, but I REMd out the other lines, so that's why there's a line 20.

      Not any more, though!

      Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
      I'm still on my learning curve, so take everything I say with caution!

      RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

      1 Reply Last reply Reply Quote 0
      • Nightowlundefined
        Nightowl @OwenD
        last edited by

        @owend Here you go...

        27/05/2022, 20:38:47 	M0
        Cancelled printing file 0:/gcodes/Calibration Toolpath.gcode, print time was 0h 0m
        27/05/2022, 20:38:33 	Printing paused at X128.8 Y122.6 Z66.0
        27/05/2022, 20:38:32 	No tool selected
        Error: Bad command: {if state.currentTool >= 0} & {tools[state.currentTool].spindleRpm >= 0}
        Error: in file macro line 6 column 36: meta command: array index out of bounds
        27/05/2022, 20:38:30 	M25
        Resume state saved
        27/05/2022, 20:38:24 	M32 "0:/gcodes/Calibration Toolpath.gcode"
        File 0:/gcodes/Calibration Toolpath.gcode selected for printing
        

        Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
        I'm still on my learning curve, so take everything I say with caution!

        RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

        1 Reply Last reply Reply Quote 0
        • Nightowlundefined
          Nightowl @OwenD
          last edited by Nightowl

          @owend Should the wriggly brackets be after the second "if"?

          I changed it anyway, and now get this in the Console:

          27/05/2022, 20:46:49 	M0
          Cancelled printing file 0:/gcodes/Calibration Toolpath.gcode, print time was 0h 0m
          27/05/2022, 20:46:44 	Printing paused at X125.6 Y125.8 Z66.0
          27/05/2022, 20:46:43 	No tool selected
          Error: in file macro line 11 column 81: meta command: array index out of bounds
          27/05/2022, 20:46:40 	M25
          Resume state saved
          27/05/2022, 20:46:35 	M32 "0:/gcodes/Calibration Toolpath.gcode"
          File 0:/gcodes/Calibration Toolpath.gcode selected for printing
          

          BTW, when I click pause, the spinde keeps running and the XY stays where it is, not returning to the safe XY.

          Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
          I'm still on my learning curve, so take everything I say with caution!

          RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

          OwenDundefined 1 Reply Last reply Reply Quote 0
          • OwenDundefined
            OwenD @Nightowl
            last edited by OwenD

            @nightowl999 said in CNC Pause and Resume config files:

            Should the wriggly brackets be after the second "if"?

            Yes, I thought I corrected that.

            But now it's clear there's no tool selected when you are pausing.
            Therefore none of the subsequent code can work as it relies on a tool being selected.
            Is this a real job, or a dummy one?

            I'm willing to bet this would work (if I haven't mage any syntax errors LOL)

            ; pause.g
            if state.currentTool = -1
            	echo "No tool selected - selecting tool zero"
            	T0
            G1 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5)} ; move the Z axis to a safe height
            if {state.currentTool >= 0} & {tools[state.currentTool].spindleRpm >= 0}
            	set global.savedSpindleSpeed = tools[state.currentTool].spindleRpm ; save current spindle speed
            	G1 X273.5 Y560 F2400 ; move XY to a safe place
            	M5 ; turn the spindle off
            	echo "Spindle speed saved at " ^ { global.savedSpindleSpeed } ^ "RPM"
            else
            	echo "condition not met - Tool is ", state.currentTool, " Spindle RPM is ", tools[state.currentTool].spindleRpm
            

            EDIT
            If this works then we need to know how many tools you have.

            Nightowlundefined 1 Reply Last reply Reply Quote 1
            • Nightowlundefined
              Nightowl @OwenD
              last edited by

              @owend I'll try it, but I'm aware you're tired (as am I!)

              Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
              I'm still on my learning curve, so take everything I say with caution!

              RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

              OwenDundefined 1 Reply Last reply Reply Quote 0
              • OwenDundefined
                OwenD @Nightowl
                last edited by

                @nightowl999 said in CNC Pause and Resume config files:

                but I'm aware you're tired (as am I!)

                It's 5:51 AM here. I'm tired because I woke at 3am and couldn't get back to sleep 😧
                Try it when you can and report back.

                Nightowlundefined 2 Replies Last reply Reply Quote 1
                • Nightowlundefined
                  Nightowl
                  last edited by

                  It works! And the spindle turns off with pause and on with resume!

                  Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                  I'm still on my learning curve, so take everything I say with caution!

                  RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                  OwenDundefined 1 Reply Last reply Reply Quote 0
                  • Nightowlundefined
                    Nightowl @OwenD
                    last edited by

                    @owend It's only 9pm here, but I've been trying to sort this all day!

                    Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                    I'm still on my learning curve, so take everything I say with caution!

                    RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                    1 Reply Last reply Reply Quote 0
                    • OwenDundefined
                      OwenD @Nightowl
                      last edited by

                      @nightowl999
                      OK,
                      So the problem was there was no tool selected.
                      I would have thought that was necessary to turn a spindle on, but maybe not.
                      If you have multiple tools then you'll need to consider how to store which tool was selected when you pause (if RRF doesn't store that in CNC mode)

                      1 Reply Last reply Reply Quote 1
                      • Nightowlundefined
                        Nightowl @OwenD
                        last edited by Nightowl

                        @owend This is how my spindle is configured in config.g:

                        ; Makita and relay configuration
                        M950 R0 C"out1+out7" L0:18000	; enable router relay on out7
                        M563 P0 S"Makita" R0 		; assign spindle 0 to tool 0 and name it Makita
                        T0				; select tool 0
                        

                        This was only configured to turn the spindle off/on via a relay, but I figured I will need this resolved for when my speed-contollable milling motor turns up. My assumption is the speed thing isn't relevant as the DI isn't connected.

                        Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                        I'm still on my learning curve, so take everything I say with caution!

                        RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                        OwenDundefined 1 Reply Last reply Reply Quote 0
                        • OwenDundefined
                          OwenD @Nightowl
                          last edited by OwenD

                          @nightowl999
                          What happens in the console when you run
                          M98 P"0:/sys/config.g"

                          You're selecting T0, so I'm at a loss why it's not selected in your job.
                          Somewhere something is turning it off.

                          Nightowlundefined 1 Reply Last reply Reply Quote 1
                          • Nightowlundefined
                            Nightowl @OwenD
                            last edited by

                            @owend said in CNC Pause and Resume config files:

                            M98 P"0:/sys/config.g"

                            From the command line?

                            Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                            I'm still on my learning curve, so take everything I say with caution!

                            RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                            OwenDundefined 1 Reply Last reply Reply Quote 0
                            • OwenDundefined
                              OwenD @Nightowl
                              last edited by

                              @nightowl999
                              yes

                              Nightowlundefined 1 Reply Last reply Reply Quote 1
                              • Nightowlundefined
                                Nightowl @OwenD
                                last edited by

                                @owend
                                Only this:

                                27/05/2022, 21:02:24 M98 P"0:/sys/config.g"
                                HTTP is enabled on port 80
                                FTP is disabled
                                TELNET is disabled
                                Error: in file macro line 66 column 27: meta command: variable 'savedSpindleSpeed' already exists

                                but I haven't 'rebooted' the Duet

                                Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                                I'm still on my learning curve, so take everything I say with caution!

                                RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                                1 Reply Last reply Reply Quote 0
                                • OwenDundefined
                                  OwenD
                                  last edited by

                                  @nightowl999
                                  OK
                                  That error is normal if you haven't rebooted.

                                  I'm at a loss why you have no tool selected when pause.g begins unless RRF deselects it when G25 is run.

                                  I've been looking through the object model a bit and I think you can do away with teh global variable and use values from the object model.
                                  I'll post something to try in 5-10 minutes

                                  Nightowlundefined 1 Reply Last reply Reply Quote 1
                                  • Nightowlundefined
                                    Nightowl @OwenD
                                    last edited by Nightowl

                                    @owend If you're sure. I don't want to stress you (or me!) out trying to resolve this. I thought this would be easy 🤣 🤣

                                    I'm going back to the hous, but I'll update the files when you post the answer ( 🙂 ) and I'll try it out toorrow morning (my time).

                                    I'm really grateful for your time and help with this, @OwenD

                                    Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                                    I'm still on my learning curve, so take everything I say with caution!

                                    RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                                    OwenDundefined 1 Reply Last reply Reply Quote 0
                                    • OwenDundefined
                                      OwenD @Nightowl
                                      last edited by OwenD

                                      @nightowl999

                                      Try these

                                      ; pause.g
                                      G1 X273.5 Y560 F2400 ; move XY to a safe place
                                      M5 ; turn the spindle off
                                      

                                      and

                                      ;resume.g
                                      if state.restorePoints[0].toolNumber =-1
                                      	"echo no tool was saved- selecting T0"
                                      	T0
                                      else
                                      	T{state.restorePoints[0].toolNumber} ; select the tool that was active
                                      if state.restorePoints[0].spindleSpeeds[0] = 0
                                      	echo "No resume speed was saved"
                                      else
                                      	M3 S{state.restorePoints[0].spindleSpeeds[0]}	; resume saved spindle speed
                                      	G4 S1					; wait 1 second to allow the spindle to spin up
                                      	echo "Spindle speed resumed at ", state.restorePoints[0].spindleSpeeds[0], "RPM" ; this should show that the setting was successful
                                      

                                      Forgot to comment "resume.g" corrected.
                                      Also I have no way of checking what's stored in the restore point arrays.

                                      Nightowlundefined 2 Replies Last reply Reply Quote 1
                                      • Nightowlundefined
                                        Nightowl @OwenD
                                        last edited by

                                        @owend I tweaked the first echo, too!

                                        Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                                        I'm still on my learning curve, so take everything I say with caution!

                                        RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                                        1 Reply Last reply Reply Quote 0
                                        • Nightowlundefined
                                          Nightowl @OwenD
                                          last edited by Nightowl

                                          @owend I need to call it a night. I've been summoned and the neighbours don't like the noise!

                                          Here's the last bit of Console text...

                                          27/05/2022, 21:28:41 	M0
                                          Printing paused at X205.3 Y258.9 Z64.0
                                          Cancelled printing file 0:/gcodes/Calibration Toolpath.gcode, print time was 0h 0m
                                          27/05/2022, 21:28:30 	M25
                                          Resume state saved
                                          27/05/2022, 21:28:29 	Printing resumed
                                          27/05/2022, 21:28:21 	M24
                                          no tool was saved- selecting T0
                                          Error: in file macro line 7 column 4: meta command: unknown value 'spindleSpeeds^'
                                          27/05/2022, 21:28:17 	Printing paused at X205.3 Y212.6 Z65.0
                                          27/05/2022, 21:28:07 	M25
                                          Resume state saved
                                          27/05/2022, 21:27:48 	M32 "0:/gcodes/Calibration Toolpath.gcode"
                                          File 0:/gcodes/Calibration Toolpath.gcode selected for printing
                                          

                                          Once again, the spindle didn't restart 😞

                                          Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                                          I'm still on my learning curve, so take everything I say with caution!

                                          RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                                          OwenDundefined 1 Reply Last reply Reply Quote 0
                                          • OwenDundefined
                                            OwenD @Nightowl
                                            last edited by

                                            @nightowl999
                                            OK.
                                            As I said, I have no way of checking exactly how the restore points for spindles work.
                                            Perhaps @DC42 could chime in at this point now that it's narrowed down and explain why there's no tool selected when you pause and also whether all the spindle speeds etc are saved in the object model.

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