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

    M0 not behaving as I would expect it to..

    Scheduled Pinned Locked Moved
    Gcode meta commands
    4
    14
    336
    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.
    • JADoglioundefined
      JADoglio
      last edited by

      Here is the description for M0 actions:

      The effect of M0 depends on the state of the machine.
      The firmware finishes any moves left in its buffer.
      Either: if the axes are homed and if a print is paused (M25), it executes the macro file cancel.g if present.
      Or: if M0 is sent at any other time, stop.g is run if present.

      The problem I am having is that when I issue M0 from the command line and the machine is running it does not execute stop.g, it reports an error that I have to pause the print before I run M0 to stop the print.

      When I add M25 as the first line of stop.g to pause the print, I get the same error and the print does not stop.

      Am I misunderstanding something here, or is this not behaving as it is supposed to?

      Thanks in advance for any help understanding this better.

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

        Firmware version?

        Z-Bot CoreXY Build | Thingiverse Profile

        JADoglioundefined 1 Reply Last reply Reply Quote 0
        • JADoglioundefined
          JADoglio @Phaedrux
          last edited by

          @Phaedrux 3.5.3

          JADoglioundefined 1 Reply Last reply Reply Quote 0
          • JADoglioundefined
            JADoglio @JADoglio
            last edited by JADoglio

            M122
            === Diagnostics ===
            RepRapFirmware for Duet 3 Mini 5+ version 3.5.3 (2024-09-18 11:25:48) running on Duet 3 Mini5plus WiFi (standalone mode)
            Board ID: 5FTQV-B396U-D65J0-40KMQ-KZ03Z-HQ1PY
            Used output buffers: 11 of 40 (32 max)
            Error in macro line 146 while starting up: in file macro line 146 column 71: meta command: unknown variable 'manual_m0_detected'
            === RTOS ===
            Static ram: 103368
            Dynamic ram: 122904 of which 132 recycled
            Never used RAM 12492, free system stack 198 words
            Tasks: NETWORK(2,nWait 7,13.9%,228) HEAT(3,nWait 1,0.0%,325) Move(4,nWait 6,0.0%,355) CanReceiv(6,nWait 1,0.0%,939) CanSender(5,nWait 7,0.0%,336) CanClock(7,delaying,0.0%,334) TMC(4,nWait 6,1.5%,110) MAIN(1,running,83.5%,665) IDLE(0,ready,0.3%,29) AIN(4,delaying,0.8%,268), total 100.0%
            Owned mutexes: WiFi(NETWORK)
            === Platform ===
            Last reset 00:01:29 ago, cause: power up
            Last software reset at 2025-02-11 15:45, reason: HardFault imprec, FilamentSensors spinning, available RAM 12492, slot 1
            Software reset code 0x406d HFSR 0x40000000 CFSR 0x00000400 ICSR 0x00489803 BFAR 0xe000ed38 SP 0x20012020 Task NETW Freestk 488 ok
            Stack: 2002c658 200322f8 200014e4 00000000 20033496 0003039d 000302b4 610f6000 2002c640 2002c640 00000001 2002c496 2001882c 2001ea80 00030523 00000000 00000000 00000000 200120b8 00000014 00000000 00000002 ebbf0050 f807a8c0 0800016a 00000001 00034c99
            Error status: 0x00
            Aux0 errors 0,0,0
            MCU revision 3, ADC conversions started 67589, completed 67588, timed out 0, errs 0
            MCU temperature: min 19.9, current 25.0, max 25.2
            Supply voltage: min 23.8, current 23.9, max 23.9, under voltage events: 0, over voltage events: 0, power good: yes
            Heap OK, handles allocated/used 99/3, heap memory allocated/used/recyclable 2048/148/36, gc cycles 0
            Events: 0 queued, 0 completed
            Driver 0: standstill, SG min 0, read errors 0, write errors 0, ifcnt 10, reads 8136, writes 10, timeouts 0, DMA errors 0, CC errors 0
            Driver 1: standstill, SG min 0, read errors 0, write errors 0, ifcnt 10, reads 8136, writes 10, timeouts 0, DMA errors 0, CC errors 0
            Driver 2: standstill, SG min 0, read errors 0, write errors 0, ifcnt 10, reads 8136, writes 10, timeouts 0, DMA errors 0, CC errors 0
            Driver 3: standstill, SG min 0, read errors 0, write errors 0, ifcnt 10, reads 8136, writes 10, timeouts 0, DMA errors 0, CC errors 0
            Driver 4: standstill, SG min 0, read errors 0, write errors 0, ifcnt 10, reads 8136, writes 10, timeouts 0, DMA errors 0, CC errors 0
            Driver 5: standstill, SG min 0, read errors 0, write errors 0, ifcnt 10, reads 8136, writes 10, timeouts 0, DMA errors 0, CC errors 0
            Driver 6: standstill, SG min 0, read errors 0, write errors 0, ifcnt 10, reads 8136, writes 10, timeouts 0, DMA errors 0, CC errors 0
            Date/time: 2025-02-12 11:20:44
            Cache data hit count 166834675
            Slowest loop: 7.17ms; fastest: 0.16ms
            === Storage ===
            Free file entries: 19
            SD card 0 detected, interface speed: 22.5MBytes/sec
            SD card longest read time 3.6ms, write time 3.6ms, max retries 0
            === Move ===
            DMs created 83, segments created 0, maxWait 0ms, bed compensation in use: none, height map offset 0.000, max steps late 0, min interval 0, bad calcs 0, ebfmin 0.00, ebfmax 0.00
            no step interrupt scheduled
            Moves shaped first try 0, on retry 0, too short 0, wrong shape 0, maybepossible 0
            === DDARing 0 ===
            Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
            === DDARing 1 ===
            Scheduled moves 0, completed 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
            === Heat ===
            Bed heaters 0 -1 -1 -1, chamber heaters -1 -1 -1 -1, ordering errs 0
            Heater 1 is on, I-accum = 0.0
            === GCodes ===
            Movement locks held by null, null
            HTTP is idle in state(s) 0
            Telnet is idle in state(s) 0
            File is idle in state(s) 0
            USB is idle in state(s) 0
            Aux is idle in state(s) 0
            Trigger is idle in state(s) 0
            Queue is idle in state(s) 0
            LCD is idle in state(s) 0
            SBC is idle in state(s) 0
            Daemon is idle in state(s) 0
            Aux2 is idle in state(s) 0
            Autopause is idle in state(s) 0
            File2 is idle in state(s) 0
            Queue2 is idle in state(s) 0
            Q0 segments left 0, axes/extruders owned 0x0000803
            Code queue 0 is empty
            Q1 segments left 0, axes/extruders owned 0x0000000
            Code queue 1 is empty
            === CAN ===
            Messages queued 808, received 0, lost 0, errs 422845, boc 0
            Longest wait 0ms for reply type 0, peak Tx sync delay 0, free buffers 26 (min 26), ts 450/0/0
            Tx timeouts 0,0,449,0,0,357 last cancelled message type 30 dest 127
            === Network ===
            Slowest loop: 9.50ms; fastest: 0.00ms
            Responder states: MQTT(0) HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0)
            HTTP sessions: 1 of 8
            === WiFi ===
            Interface state: active
            Module is connected to access point 
            Failed messages: pending 0, notrdy 0, noresp 0
            Firmware version 2.1.0
            MAC address d8:bf:c0:14:df:67
            Module reset reason: Power up, Vcc 3.33, flash size 2097152, free heap 36436
            WiFi IP address 192.168.4.79
            Signal strength -39dBm, channel 11, mode 802.11n, reconnections 0
            Clock register 00002001
            Socket states: 0 0 0 0 0 0 0 0
            
            dc42undefined 1 Reply Last reply Reply Quote 0
            • Phaedruxundefined
              Phaedrux Moderator @JADoglio
              last edited by

              @JADoglio said in M0 not behaving as I would expect it to..:

              When I add M25 as the first line of stop.g to pause the print, I get the same error and the print does not stop.

              I don't think that's going to work. You'd have to issue the pause first, and then cancel.

              What exactly are you trying to achieve?

              Z-Bot CoreXY Build | Thingiverse Profile

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

                @JADoglio M0 was originally intended to be used in sequential job files. In RRF it is also allowed to terminate a paused job, to save inventing another command. It is not intended to instantly stop a running Job. You should use M112 for that.

                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

                JADoglioundefined 1 Reply Last reply Reply Quote 0
                • JADoglioundefined
                  JADoglio @dc42
                  last edited by

                  @dc42

                  Phaedrux, I was just trying to find a way to do one click stop print with the option to leave the heaters on. I often find I start a print and quickly figure out that I made some mistake and need to adjust something. It is easy enough to do it with pause and cancel. The issue is it takes a few more seconds while the system writes the resume data and then calls the option to cancel and it also turns off the heaters and fans even though the next print starts seconds later. I thought this would be easy.

                  It seems it is not. In trying to do this I also became very familiar with the process and limitations of M0. I was also a bit surprised to learn that M0 is called automatically at the end of every print. I use a stop print macro to do the same things, not knowing it was not needed. I understand this was probably built in for safety reasons. The feature to make sure the heaters and fans were turned off after the print is good but it would be nice to have the option to manually turn that off and use my own macros to manage how the print ends..

                  DC42, thanks for the suggestion. Based on the above you have probably figured out why M112 is not a preferred option.

                  I appreciate the help. You might want to consider update M0 so when it is issued from the command line it pauses the print (if it is not already), then stops the print using stop.g.

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

                    @JADoglio you can create a macro to pause and cancel a job with one press of a button.

                    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

                    JADoglioundefined 1 Reply Last reply Reply Quote 0
                    • JADoglioundefined
                      JADoglio @dc42
                      last edited by JADoglio

                      @dc42

                      Interesting, I have written a lot of macros and I have been learning how to use variables and and adding logic to the macros. So, of you are referring to just creating a macro to this, that is not what I am looking for. If I can create a macro and then create a button on the status page (on both the DWC and the Panel Due) to activate it, that would be perfect? Is that possible? If it is, what resources can you point me to to see how this would work. Thanks

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

                        @JADoglio you can have macro buttons on the Dashboard page of DWC (Control page of PanelDue) but not on the Status pages.

                        There is a plugin for DWC called BtnCmd (https://github.com/MintyTrebor/BtnCmd) that lets you create custom layouts and buttons - perhaps that would be useful to you.

                        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

                        JADoglioundefined 1 Reply Last reply Reply Quote 0
                        • JADoglioundefined
                          JADoglio @dc42
                          last edited by

                          @dc42 Thanks I will have a look!

                          1 Reply Last reply Reply Quote 0
                          • JADoglioundefined
                            JADoglio
                            last edited by

                            Thanks, I installed the add in and it should be useful. Can buttons be added to the standard pages that already exist in DWC like "Status" or "Dashboard" using this tool, or is that beyond what it was designed to do? Also, this only solves part of the issue. The bigger issue is how do I cancel or intercept the inherent M0 issued by Rep Rap so the firmware does not ALWAYS turn off the heaters at the end of the gcode execution for a print. Since the inherent M0 runs after the machine configured end print script runs, I should be able to intercept it and cancel/modify it before it executes. I am pretty sure at this point that it can't be, but it seems I should be able to configure the execution of my files to behave as I want them to. Your thoughts are always appreciated.

                            jay_s_ukundefined dc42undefined 2 Replies Last reply Reply Quote 0
                            • jay_s_ukundefined
                              jay_s_uk @JADoglio
                              last edited by

                              @JADoglio no, it can't add buttons to other pages than it's own.
                              I use global variables if I want to override heaters turning off https://github.com/TeamGloomy/Troodon-V2/blob/improved/Config/sys/stop.g

                              Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

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

                                @JADoglio said in M0 not behaving as I would expect it to..:

                                The bigger issue is how do I cancel or intercept the inherent M0 issued by Rep Rap so the firmware does not ALWAYS turn off the heaters at the end of the gcode execution for a print.

                                When M0 is executed within a print job (and in 3.6, when the end of the job file is reached without encountering M0), RRF runs file sys/stop.g if it exists, otherwise it uses the default behaviour which is to turn off all heaters. So you can change the behaviour by creating a stop.g file.

                                When M0 is run when the print is paused. RRF first tries to run sys/cancel.g, then if that isn't found it behaves as above.

                                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

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