Strange results with M190 using conditional G Code RRF 3.3b2
-
I'm raising this in it's own thread for clarity.
Original discussion here https://forum.duet3d.com/post/220209If you run this macro, starting at say 70 degrees, the temp often goes straight to 39 degrees.
Other times it decrements by 1 degree as expectedwhile (heat.heaters[0].active > 60) && (heat.heaters[0].current > 60) && (heat.heaters[0].state = "active") M190 P0 R{heat.heaters[0].active -1} echo "wait" G4 S20 echo "cooldown finished"
However if you use variables to set the target and use the variable in M190, the result is always exactly as expected.... A 1 degree reduction at each iteration
var cooltemp = {heat.heaters[0].active} while (heat.heaters[0].active > 60) && (heat.heaters[0].current > 60) && (heat.heaters[0].state = "active") set var.cooltemp = var.cooltemp -1 M190 P0 R{var.cooltemp} echo "wait" G4 S20 echo "cooldown finished"
-
- bump *
Any thoughts on this?
- bump *
-
@owend
About the 39°C: I think it's related to the limitation of M190 R.
The R value doesn't work below 40°C...Coincidence?
I think that the question belongs in the "Beta firmware" section, as it seems to be an issue with M190. -
-
@phaedrux
Not sure how the 40 degree limit relates when we're starting at 60 or 70 degrees and reducing in 1 degree steps.
It's not critical as I can work around it using variables to do the math before the M190
It only fails if the math is done within the M190 -
@owend
If I had to integrate a Daemon.g into a very timing-related program such as RRF, I'd not run the whole Daemon at once, but would squeeze it between my already running program line by line. (or the shortest possible code snipped)
That way you can set a waiting time with G4 S20 in Daemon.g, while the real print-routine goes on.That would work well, unless there is a line that calls another sub-program in a subprogram. M190 P0 R{heat.heaters[0].active -1} is such a line. It calls the 'math' routine with (-1) while being in the subroutine of M190.
It's just wild guessing, but maybe there is a limitted level of subroutines for Daemon.g?