After some experimenting, this works....
1) Set the axis to immediate homing (HOME_SEARCH_VELOCITY = HOME_LATCH_VELOCITY = 0 )
2) Toggle halui.mode.joint
3) Toggle halui.joint.0.unhome
4) Toggle halui.joint.0.home
(At this point the machine will automatically switch out of joint mode)
One way to do this is with a custom M-code. Save the following as a file called M100 in your nc_files directory and make it executable (either from the file manager properties or chmod +x M100.
Code:
#! /bin/bash
mode=$(halcmd getp halui.mode.is-manual)
echo $mode
halcmd setp halui.mode.manual 1
while [ $mode == 'FALSE' ];do
sleep 0.1
mode=$(halcmd getp halui.mode.is-manual)
echo mode is manual $mode
done
halcmd setp halui.mode.manual 0
mode=$(halcmd getp halui.mode.is-joint)
echo $mode
halcmd setp halui.mode.joint 1
while [ $mode == 'FALSE' ];do
sleep 0.1
mode=$(halcmd getp halui.mode.is-joint)
echo mode is joint $mode
done
halcmd setp halui.mode.joint 0
mode=$(halcmd getp halui.joint.0.is-homed)
echo $mode
halcmd setp halui.joint.0.unhome 1
while [ $mode == 'TRUE' ];do
sleep 0.1
mode=$(halcmd getp halui.joint.0.is-homed)
echo joint is homed $mode
done
halcmd setp halui.joint.0.unhome 0
mode=$(halcmd getp halui.joint.0.is-homed)
echo $mode
halcmd setp halui.joint.0.home 1
while [ $mode == 'FALSE' ];do
sleep 0.1
mode=$(halcmd getp halui.joint.0.is-homed)
echo joint is homed $mode
done
halcmd setp halui.joint.0.home 0
exit 0
It isn't as complicated as it might look, it just sets a pin and waits for the result for four different HAL pins in sequence.
Note that this will _not_ work inside a G-code programme because it requires a mode change to manual (out of auto)
I think that you might have to use G10 inside the G-code and M100 on spool change or similar.
The code does not have to be run from MDI M100, it could be linked to a physical button as a HALCMD (see the INI docs)
Or, it could be coded in Python, in which case it could watch a HAL pin and do the reset then.
It might not make sense for this to be an axis at all....