Check if a specific tool is selected and set it to standby
-
@phil333 which firmware are u using?
-
I am using as
Board: Duet 2 Ethernet (2Ethernet)
Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0beta5+1 (2021-10-28) -
-
@phil333 said in Check if a specific tool is selected and set it to standby:
Error: in file macro line 19 column 29: M568: expected numeric operand
It would help if you tell us what is in line 19 of the macro file.
-
@dc42 i think first there was (with error in the last line):
if tools[1].state="active" then M568 P1 R{tools[1].active}
and then second try with variable (also error in the last line:
var temp = {tools[1].active} ... ... ... if tools[1].state="active" then M568 P1 R{var.temp}
-
@dc42 said in Check if a specific tool is selected and set it to standby:
@phil333 said in Check if a specific tool is selected and set it to standby:
Error: in file macro line 19 column 29: M568: expected numeric operand
It would help if you tell us what is in line 19 of the macro file.
Its the snippet that @cosmowave suggested:
then M568 P1 R{var.temp1}
The whole macro is:
;if tools[0].state="active" ; then M568 P0 R{tools[0].active} ; echo "tool 0 (V6) ist active." ;if tools[1].state="active" ; then M568 P1 R{tools[1].active} ; echo "tool 1 (Volcano) ist active." var temp0 = {tools[0].active} var temp1 = {tools[1].active} if tools[0].state="active" then M568 P0 R{var.temp0} echo "tool 0 (V6) ist active." if tools[1].state="active" then M568 P1 R{var.temp1} echo "tool 1 (Volcano) ist active."
-
@phil333 remove all instances of "then".
-
@dc42 sorry, forgotten to mention that. He has tried it without "then".
-
@cosmowave "then" is not valid conditional gcode so it needs to be removed from the file. Hopefully any actual error may become apparent when its not being masked by the "thens"
-
@dc42, @T3P3Tony and @cosmowave
If there is no "then" like this:
;if tools[0].state="active" ; then M568 P0 R{tools[0].active} ; echo "tool 0 (V6) ist active." ;if tools[1].state="active" ; then M568 P1 R{tools[1].active} ; echo "tool 1 (Volcano) ist active." var temp0 = {tools[0].active} var temp1 = {tools[1].active} if tools[0].state="active" M568 P0 R{var.temp0} echo "tool 0 (V6) ist active." if tools[1].state="active" M568 P1 R{var.temp1} echo "tool 1 (Volcano) ist active."
I still get this back:
M98 P"0:/macros/00_Toolselect_check"
Error: in file macro line 15 column 24: M568: expected numeric operand
tool 0 (V6) ist active.The error appears in this line:
M568 P0 R{var.temp0}
On:
Board: Duet 2 Ethernet (2Ethernet)
Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0beta5+1 (2021-10-28) -
-
This post is deleted! -
@phil333
What do you get if you send
echo tools[0].active
in the console?
I think it will be true/false not numericalTry
var temp = heat.heaters[state.currentTool].active
However you need to make sure there is an active tool
So perhaps
var temp = 0 if state.currentTool > -1 set var.temp = heat.heaters[state.currentTool].active M568 P{state.currentTool} R{var.temp}
This was done on my phone so tabs won't be correct!
-
var.temp0 evaluates to tools[0].active which points to an array containing elements (of I guess extruders) with the temperature for respective extruder (normally 0).
So if you write like this instead:
var temp0 = 0 if #tools[0].active != 0 set var.temp0 = {tools[0].active[0]} ;end if
I don't know if that answers your question some?