Setting object model value
-
I would like to set an object variable, specifically the flag of an axis being homed.
I can query the object model via via an if/else statement such as
If move.axes[2].homed
do stuffBut how do I set an object variable?
I would have thought that
set move.axes[2].homed = false
would make sense but of course that is incorrect ... so how can I do this ? -
@jens55
Short answer is you can't.
The object model is a read only reflection of the state of the machine.
It would be dangerous to allow write access to anything that isn't user created.
i.e global variablesIf you want to "un-home" an axis, I suppose you could turn the motor off momentarily. There may be other ways.
-
@OwenD .... well that sucks .... but I guess it makes sense. Ok, off to figure out plan 'b'.
Thanks -
When I run G28 Z, the Duet flags the axis as unhomed. Is there a g code that does this?
If I turn off the z motors there is a possibility of my bed tilt to be affected which then means I would have to run the full homez.g file to re-establish everything. This would defeat the whole idea of what I am trying to do (avoid running the bed tilt compensation procedure) -
@jens55
The firmware would mark the axis as unhomed at the start of any homing procedure and mark it homed again after successfully completing the relevant home macro.
Normally bed tilt compensation would done in bed.g and called using G32
If you're calling G32 from inside homez.g then you could create a global variable and use that as the conditional trigger for calling G32 -
@OwenD, as it turns out, I am indeed calling for G32 from inside my homez.g file. I wonder if you could elaborate on your suggestion of using a global variable. How would you implement this?
-
@jens55
Try something like thisin config.g
if !exists global.bedLevelDone global bedLevelDone = false else set global.bedLevelDone = false
in your home.z
if global.bedLevelDone = false G32 ; do your Z homing
in bed.g
; do your bed levelling set global.bedLevelDone = true
You would also need to set the global to false at any time where the motors may be powered down.
-
@OwenD, thank you, I will see if I can manage to cobble something together !