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

    Macro commands being split?

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    2
    3
    156
    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.
    • OwenDundefined
      OwenD
      last edited by

      Board: Duet 2 WiFi (2WiFi)
      Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0beta6 (2021-11-06)
      Duet WiFi Server Version: 1.26

      while testing a macro in relation to this thread I have been getting some weird errors that seem to indicate that the commands are being submitted in part as if they are split.
      I tried removing all spaces etc with no change.

      The macro is called in an "On layer change" using this command
      M98 P"0:/macros/tuning/PA_adjust.g" I0.05 C5 S0

      this is the macro

      ; macro - PA_adjust.g
      if job.layer = null
      	echo "no layer value found in object model"
      	M99 ; break out of macro if we can't get layer info yet
      else
      	echo "processing layer " ^ job.layer
      	
      if !exists(param.C)
         abort "no C parameter passed to macro" 
      
      if !exists(param.I)
      	abort "no I parameter passed to macro"
      
      if !exists(param.S)
      	abort "no S parameter passed to macro"
      
      if !exists(global.AtChangePoint)
      	global AtChangePoint=false
      else
      	global.AtChangePoint=mod(job.layer/param.C)=0 ; should only evaluate to true every X x ChangeValue
      
      if job.layer < param.C
      	M572 D0 S{param.S}
      	echo "M572 value set to " ^ {param.S}
      else
      	if global.AtChangePoint=true
      		M572 D0 S{floor(job.layer/param.C)*param.I}
      		echo "M572 value set to " ^ {floor(job.layer/param.C)*param.I+param.S}
      

      These are the errors that occur when the layer height gets to the point where the final section is evaluated
      Screenshot 2021-12-05 at 21-17-47 3Dprinter.png

      gloomyandyundefined 1 Reply Last reply Reply Quote 0
      • gloomyandyundefined
        gloomyandy @OwenD
        last edited by

        @owend You need to use "set" when assigning a new value to a variable so...

        global.AtChangePoint=mod(job.layer/param.C)=0
        

        Needs to be

        set global.AtChangePoint=mod(job.layer/param.C)=0
        
        OwenDundefined 1 Reply Last reply Reply Quote 0
        • OwenDundefined
          OwenD @gloomyandy
          last edited by

          @gloomyandy said in Macro commands being split?:

          @owend You need to use "set" when assigning a new value to a variable so...

          global.AtChangePoint=mod(job.layer/param.C)=0
          

          Needs to be

          set global.AtChangePoint=mod(job.layer/param.C)=0
          

          Of course I do!
          Well that's embarrassing 😳

          1 Reply Last reply Reply Quote 0
          • OwenDundefined OwenD has marked this topic as solved
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA