Problem meta gcode 3.4.0b5
-
Hi all and specifically @dc42,
I'm pretty sure this is a new problem introduced in the new beta release as I didn't have this problem before. I'm running 3.4.0b5 in SBC mode.
I have this bit of code normally used to change some LEDs in my printer but I isolated it a bit to see if it still threw an error.var currentTemp = heat.heaters[{global.heaterLedState}].current if var.currentTemp <= 30 var roomTemp = var.currentTemp var rampUp = 0 echo "<30" echo var.rampUp echo var.roomTemp
If I run this macro it returns the following:
<30
Error: Failed to evaluate "var.rampUp": unknown variable 'rampUp' of check.g
So it looks like it does get into the if statement but does not set the variable even though it does set the variable currentTemp which is not in an if statement. I'm confused.
Curious for an answer.
Kind regards, Piet.
-
@piet as with programming languages, local variables are local to the block in which they are created. So those two variables cease to exist after the if-block.
There was a bug in SBC mode in previous versions, that caused local variables to have incorrect scope.
-
@dc42 Ah thanks for clearing that up!