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

how to create conditional commands

Scheduled Pinned Locked Moved
Tuning and tweaking
4
10
531
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.
  • undefined
    tekstyle
    last edited by tekstyle 6 Jan 2021, 05:44 1 Jun 2021, 05:43

    i am no programmer nor engineer. I have been looking at this page to learn how to write some code for my machine. https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands#Section_Variables_and_Macro_Parameters.

    I have 1 simple IF command that I use right now courtesy of someone's help but I just don't understand how I would know what nomenclature or syntax to use that duet will understand.

    for example:
    {heat.heaters[1].current < 150}.
    How do you guys know to use heat.heaters[1].current? I know the number [1] stands for the heater number in series but what about heat.heaters?

    if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
    how do you know to use !move.axes[0]. homed?

    i guess what i want to know is is there is like a list of naming convention that duet will understand and if there is one available to draw from.

    undefined undefined 2 Replies Last reply 1 Jun 2021, 05:50 Reply Quote 0
    • undefined
      cosmowave @tekstyle
      last edited by 1 Jun 2021, 05:50

      @tekstyle
      you can use the object model browser plug in.
      there you see all possible variables of your system!

      Mankati FSXT+, DeltaTowerV2, E3D MS/TC

      undefined 1 Reply Last reply 1 Jun 2021, 06:15 Reply Quote 0
      • undefined
        tekstyle @cosmowave
        last edited by 1 Jun 2021, 06:15

        @cosmowave
        how do i do that?

        undefined 1 Reply Last reply 1 Jun 2021, 06:40 Reply Quote 0
        • undefined
          cosmowave @tekstyle
          last edited by 1 Jun 2021, 06:40

          @tekstyle
          which FW are you using?

          Mankati FSXT+, DeltaTowerV2, E3D MS/TC

          undefined 1 Reply Last reply 1 Jun 2021, 17:02 Reply Quote 0
          • undefined
            tekstyle @cosmowave
            last edited by 1 Jun 2021, 17:02

            @cosmowave

            duet2 RRF3.1.1 I think it is.

            1 Reply Last reply Reply Quote 0
            • undefined
              Phaedrux Moderator
              last edited by 1 Jun 2021, 17:46

              You'll need to update to 3.2.2 firmware and DWC at least.

              https://github.com/Duet3D/RepRapFirmware/releases/download/3.2.2/Duet2and3Firmware-3.2.2.zip

              Z-Bot CoreXY Build | Thingiverse Profile

              undefined 1 Reply Last reply 2 Jun 2021, 00:30 Reply Quote 0
              • undefined
                tekstyle @Phaedrux
                last edited by 2 Jun 2021, 00:30

                @phaedrux

                i just got done updating to 3.2.2. i enabled object modelling but where do I see the variables and in what way I can use them?

                1 Reply Last reply Reply Quote 0
                • undefined
                  Phaedrux Moderator
                  last edited by 2 Jun 2021, 00:55

                  Sorry, my mistake. Variables is part of the 3.3 beta release. RC3 is available now. Final release soon. https://github.com/Duet3D/RepRapFirmware/releases/tag/3.3RC3

                  Even so, there are no pre-defined variables. You would define them yourself and use them with your conditional gcode as described in the link you included in your first post.

                  Z-Bot CoreXY Build | Thingiverse Profile

                  1 Reply Last reply Reply Quote 0
                  • undefined
                    tekstyle
                    last edited by tekstyle 6 Feb 2021, 22:26 2 Jun 2021, 22:23

                    @phaedrux
                    can you see if this is a valid command?
                    I want hotend to turn off if print pause due to heater fault. but I want hotend to hold current temperature last commanded based on what's inside the pause.g file (either it be active or standby temp), if the print pauses for any other reason.

                    I am still learning what to enter for {xxx.xxx[#].xxx} or if it is even entered correctly. all these coding is foreign to me.

                    Also, where would I put this line of code? in config.g or at the end of the pause.g

                    while {state.status.value == "paused"} ;if status is "paused"
                    (indent) if {heaters[1].state = "fault"} ; and if heater 1 has heater fault
                    (indent) M104 H1 S{heat.heaters[1].0] ; set Heater 1 to 0C
                    else {state.status.value == "paused"} ;if status is "paused"
                    (indent) if {heaters[1].state != "fault"} ; and if heater 1 has no heater fault
                    (indent) M104 H1 S{heat.heaters[1].current] ; set Heater 1 to current

                    1 Reply Last reply Reply Quote 0
                    • undefined
                      Fabmonkey @tekstyle
                      last edited by 18 Feb 2022, 07:05

                      @tekstyleI know this is an old post, but I was searching for the same thing today and found the answer here :

                      https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation

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