io: initialize the tool-in-spindle info correctly
io: initialize the tool-in-spindle info correctly

IO reports the tool number of the tool currently in the spindle in two
ways: by the hal pin iocontrol.0.tool-number, and by the emcioStatus
field tool.toolInSpindle.

Before this commit, these two variables were not initialized correctly
at startup (they were updated at the first tool change, and correct
there after).  This commit fixes the initialization these variables.

On machines with nonrandom tool changers, LinuxCNC assumes it starts up
with the spindle empty, indicated by tool number 0 in this config.

On machines with random tool changers, LinuxCNC normally starts up with
a tool in the spindle (possibly T0 which is commonly used to denote
"no tool").  In the situation where the tool table does not indicate a
tool in the spindle, the "error" tool number -1 is reported.

Signed-off-by: Sebastian Kuzminsky <62d754cc350e84d3b1c32ae79f976f5348e74a40@highlab.com>

ikcalB/linuxcnc-mirror,bmwiedemann/linuxcnc-mirror,bmwiedemann/linuxcnc-mirror,ikcalB/linuxcnc-mirror,ikcalB/linuxcnc-mirror,bmwiedemann/linuxcnc-mirror,bmwiedemann/linuxcnc-mirror,ikcalB/linuxcnc-mirror,bmwiedemann/linuxcnc-mirror,bmwiedemann/linuxcnc-mirror,ikcalB/linuxcnc-mirror,bmwiedemann/linuxcnc-mirror,ikcalB/linuxcnc-mirror,ikcalB/linuxcnc-mirror