Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Mode (CNC, Laser, FFF) state in Object Model

    Gcode meta commands
    3
    6
    134
    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.
    • EducatingSavvas
      EducatingSavvas last edited by

      Hiya - I wanted to ask if the object model includes modes such as CNC, Laser, FFF and if it is possible to add variable ones (such as drawings mode and tangential knife mode). I'd like to add something to the demon.g or start.g files which changes how the machine behaves when in different modes.

      Thanks, Savvas

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

        @educatingsavvas Those values are predefined by the firmware. Certain codes do behave differently per selected mode so it wouldn't be very trivial to add new ones. However, with 3.3(-RC3) you could probably introduce a global variable and make your own DWC fork that displays it instead of the selected mode.

        Duet software engineer

        EducatingSavvas 1 Reply Last reply Reply Quote 1
        • EducatingSavvas
          EducatingSavvas @chrishamm last edited by

          Thanks @chrishamm - do you know if there are any guides about using global variable? I guess for now I could write something like:

          while state.machinemode.cnc
          

          to define behaviour. Of I could base this on the tool number which would make it a lot simpler. For example I have relays which power a dust extractor that only need to run when tool 1 (spindle) is used for a job and should stop when using tool 2 (drawings tool) is selected.

          while state.currentTool.0
          
          OwenD 1 Reply Last reply Reply Quote 0
          • OwenD
            OwenD @EducatingSavvas last edited by OwenD

            @educatingsavvas
            Couldn't you just put the code to turn them on and off in the tool change macros?
            Tpre.g and Tfree.g
            https://duet3d.dozuki.com/Wiki/ConfiguringRepRapFirmwareCartesianPrinter#Section_Tool_change_files

            EducatingSavvas 1 Reply Last reply Reply Quote 1
            • EducatingSavvas
              EducatingSavvas @OwenD last edited by

              @owend
              I want to try avoid duplicated code so I've created a series of conditions and this is the one to control the relays - at the moment I call the file into start.g with M98. M10.g and M9.g have the relevant M42 command.

              if state.status == "processing" | state.status == "starting" | state.status == "resuming"
              	M10
              	G4 P2000
              	M7
              
              else state.status == "paused" | state.status == "idle"
              	M9
              	M11
              
              

              I think adding a while state.currentTool before this should work. I'll experiment after work...

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

                @educatingsavvas See https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Variables. Note that you need v3.3(-RC3) or newer if you are using your board in SBC mode.

                Duet software engineer

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