Macro commands being split?
-
Board: Duet 2 WiFi (2WiFi)
Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0beta6 (2021-11-06)
Duet WiFi Server Version: 1.26while 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 S0this 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
-
@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
-
@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 -
undefined OwenD has marked this topic as solved