Alarm if machine position is set while the machine is moving
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Mon, 5 Sep 2016 01:23:29 +0000 (18:23 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Mon, 5 Sep 2016 01:23:29 +0000 (18:23 -0700)
src/machine.c

index f37f021693088ab57cfa31b1dbae0dd259e72f0b..6fa9bcdea8fa626c4d035a4ee1b1d0d742ca9425 100644 (file)
@@ -721,7 +721,10 @@ static void _exec_offset(float *value, float *flag) {
  * mp_get_runtime_busy() to be sure the system is quiescent.
  */
 void mach_set_position(int axis, float position) {
-  // TODO: Interlock involving runtime_busy test
+  if ((mp_get_state() != STATE_HOLDING && mp_get_state() != STATE_READY) ||
+      mp_get_runtime_busy())
+    CM_ALARM(STAT_INTERNAL_ERROR);
+
   mach.position[axis] = position;
   mach.ms.target[axis] = position;
   mp_set_planner_position(axis, position);