Conditional Macro : check temp and Pulse an IO
-
@M7460
I haven't done a lot gcode conditionals lately, so I might be wrong:
The if M105.... line looks suspicious to me.
How does the macro know if the temp values of all sensors must be >193 or just one of them?
Try that instead:if {m105 P0 S <= 193 } && {m105 P1 S <= 193} && {m105 P2 S <= 193} M42 P8 S1 ; don't forget to indent the following lines to link them to the if-term
I also think that "=<" is not the right term. "<=" seems more like it, or better use "<193.1"?
-
Thanks @o_lampe ,
I get the following error :
Error: Failed to read code from macro Allow Print to start : Failed to evaluate "{m105 P0 S <= 193 } && {m105 P1 S <= 193} && {m105 P2 S <= 193}": unknown value 'm105'
It looks like the m105 is the wrong command to get a reading ....
-
@M7460 you need to use the object model name e.g.
heat.heaters[1].current
-
@jay_s_uk could you please explain a little more ?
extract from my config.g
; Heaters M308 S0 P"spi.cs0" Y"rtd-max31865" A"Top Heater" ; configure sensor 0 as PT100 on pin spi.cs0 M950 H0 C"out3" T1 ; create nozzle heater output on out3 and map it to sensor 0 M143 H0 S400 ; set temperature limit for heater 0 to 400C M308 S1 P"spi.cs1" Y"rtd-max31865" A"Nozzle" ; configure sensor 1 as PT100 on pin spi.cs1 M950 H1 C"out1" T0 ; create nozzle heater output on out1 and map it to sensor 1 M143 H1 S400 ; set temperature limit for heater 1 to 400C M308 S2 P"spi.cs2" Y"rtd-max31865" A"Middle Heater" ; configure sensor 2 as PT100 on pin spi.cs2 M950 H2 C"out2" T2 ; create nozzle heater output on out2 and map it to sensor 2 M143 H2 S400 ; set temperature limit for heater 2 to 400C M570 H1 S30 T30 M570 H2 S30 T30 M570 H0 S30 T30 M307 H0 R0.939 K0.115:0.000 D28.67 E1.35 S1.00 B0 M307 H2 R0.832 K0.138:0.000 D23.81 E1.35 S1.00 B0 M307 H1 R1.055 K0.105:0.000 D35.82 E1.35 S1.00 B0
-
@M7460 all your printer details get loaded into the object model in the firmware. you can't use commands in the way you have to get information.
There is a plugin for DWC to allow you to browse the object model in real time
There is more information on the object model here https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation -
@jay_s_uk awesome ! found my heaters ! So i do not get any error on the console but my IO fires even though I'm not in the correct temp range .
any thoughts?
M42 P8 S0 if {heat.heaters[0].current <193 } && {heat.heaters[1].current <193} && {heat.heaters[2].current <193} M42 P8 S1 ; don't forget to indent the following lines to link them to the if-term G4 P10000 M42 P8 S0 `
-
@M7460 what temps are being displayed for all 3 heaters currently?
-
@jay_s_uk 17c its cold today !
-
@M7460 thats expected then as you're doing a less than check on all 3
-
What an ass haha thanks for all your help ! is there anything i can so to add a warning if it not up to temp then exit and stop the macro ?
-
@M7460 you could add either an
elif
with the conditions where you want the error or just anelse
to capture everything that doesn't meet theif
.
The something like M118 to post the message.
abort
can be used to stop the run on a macro https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#abort-command