Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Problem meta gcode 3.4.0b5

    Scheduled Pinned Locked Moved
    Beta Firmware
    2
    3
    157
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Pietundefined
      Piet
      last edited by Piet

      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.

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @Piet
        last edited by

        @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.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        Pietundefined 1 Reply Last reply Reply Quote 0
        • Pietundefined
          Piet @dc42
          last edited by

          @dc42 Ah thanks for clearing that up!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA