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

    Elegant way to cancel a print during start

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    5
    9
    639
    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.
    • jay_s_ukundefined
      jay_s_uk
      last edited by

      I'm adding some checks to my start print file and would like to be able to abort a print if some criteria aren't met (such as nozzle diameter, missing parameters etc).
      I'm not sure what the most appropriate way to do this is.
      I could use M226 to pause the print and then cancel it, but I don't want pause.g or cancel.g to be ran as the printer isn't even in a state where running those would be sensible.
      Does anyone know of a better way to achieve this?

      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

      chrishammundefined 1 Reply Last reply Reply Quote 0
      • chrishammundefined
        chrishamm administrators @jay_s_uk
        last edited by chrishamm

        @jay_s_uk I invoke a macro file check-filament.g from my start G-code to check the loaded filament (M98 P"check-filament.g" F"PLA" e.g.). It's simple as this:

        if move.extruders[0].filament != param.F
          abort "Incorrect filament loaded!"
        

        That will effectively abort the print if the wrong filament is loaded without running any pause/stop macros.

        Duet software engineer

        sinned6915undefined 1 Reply Last reply Reply Quote 6
        • jay_s_ukundefined
          jay_s_uk
          last edited by

          @chrishamm fantastic. I'll give that a go now

          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
          • jay_s_ukundefined jay_s_uk marked this topic as a question
          • jay_s_ukundefined jay_s_uk has marked this topic as solved
          • Phaedruxundefined Phaedrux moved this topic from General Discussion
          • sinned6915undefined
            sinned6915 @chrishamm
            last edited by

            @chrishamm said in Elegant way to cancel a print during start:

            @jay_s_uk I invoke a macro file check-filament.g from my start G-code to check the loaded filament (M98 P"check-filament.g" F"PLA" e.g.). It's simple as this:

            if move.extruders[0].filament != param.F
              abort "Incorrect filament loaded!"
            

            That will effectively abort the print if the wrong filament is loaded without running any pause/stop macros.

            How would this work? What is the piece that you are looking at to compare in the logic statement?

            Where/How are you defining the filament?

            sinneD

            chrishammundefined 1 Reply Last reply Reply Quote 0
            • chrishammundefined
              chrishamm administrators @sinned6915
              last edited by

              @sinned6915 It's the F parameter passed to the check-filament.g macro, see the first line. My start G-code looks like this (PrusaSlicer):

              M98 P"check-filament.g" F"[filament_type]"
              M140 S[first_layer_bed_temperature]
              M116 ; wait for all temps to be reached
              T0 ; select first tool
              M703 ; configure it
              G10 P0 S[first_layer_temperature] ; set nozzle temperature
              G28 ; home all axes
              G1 X235 Y5 F30000 ; go to corner of the bed
              G1 Z0.5 ; lower nozzle
              M116 ; wait for all temps to be reached
              

              Note that you need to create filaments in DWC and PrusaSlicer where the name must equal the value defined in PS -> Filament -> Advanced -> Type.

              Duet software engineer

              sinned6915undefined 1 Reply Last reply Reply Quote 1
              • sinned6915undefined
                sinned6915 @chrishamm
                last edited by

                @chrishamm so do you you use the 'Filaments' to do things like organize, track usage, retraction and such too?

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

                  @sinned6915
                  Yes, the filaments folders are being used.
                  If you look at the start g code there is an M703.
                  Anything filament specific would be implemented in the filament config.g

                  1 Reply Last reply Reply Quote 0
                  • Diamondbackundefined
                    Diamondback
                    last edited by

                    Fantastic idea, I will certainly add this to my setup! 🙂

                    1 Reply Last reply Reply Quote 0
                    • Diamondbackundefined
                      Diamondback
                      last edited by

                      Does anyone have an idea how I can detect in PrusaSlicer which tools will be used during a print? I'm already sending over the filaments and the nozzle sizes, but since I have a toolchanger, ideally I'd also need to know which tools are used during a given print...

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