how to create conditional commands
-
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.
-
@tekstyle
you can use the object model browser plug in.
there you see all possible variables of your system! -
@cosmowave
how do i do that? -
@tekstyle
which FW are you using? -
duet2 RRF3.1.1 I think it is.
-
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
-
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?
-
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.
-
@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 -
@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