Added some state machine machinery to the imusensors