@@ -131,10 +131,11 @@ pin out bit motor-rev "Indicates the motor should run reverse.";
131131pin out bit parity-error "Indicates a parity error";
132132pin out signed current-position "This pin indicates the current position feedback";
133133pin out float motor-vel "The duty-cycle or velocity to drive a DC motor or stepgen";
134+ pin out bit homed = 0 "Shows that homing is complete. Only used in index and edge modes";
135+ pin in bit unhome = 0 "Should only really be necessary for testing";
134136
135137param r signed state = 0 "Current component state";
136138param r bit homing = 0 "Shows that homing is in progress. Only used for index mode";
137- param rw bit homed = 0 "Shows that homing is complete. Only used in index and edge modes";
138139param r float timer "Shows the value of the internal timer";
139140param r signed motor-dir "Internal tag for search direction";
140141
@@ -152,6 +153,7 @@ variable int inst_parity;
152153variable int old_index = 0;
153154variable int base_counts = 0;
154155variable int target;
156+ variable int old_unhome = 0;
155157function _ ;
156158
157159include "rtapi_math.h";
@@ -285,6 +287,10 @@ FUNCTION(_){
285287 // mod is odd with negatives, so just in case
286288 if (mod_pocket < 1) mod_pocket = 1;
287289 if (mod_pocket > inst_pockets) mod_pocket = inst_pockets;
290+
291+ if (unhome && ! old_unhome) homed = 0;
292+ old_unhome = unhome;
293+
288294 switch (state){
289295 case 0: // waiting at start
290296 motor_dir = 0;
@@ -459,6 +465,7 @@ FUNCTION(_){
459465 break; // So that we don't see the tool1 pulse twice
460466 case 20: //jogging fwd/rev
461467 if (current_position != target) return;
468+ if (align_dc != 0 && ! align_pin) return;
462469 motor_fwd = 0;
463470 motor_rev = 0;
464471 motor_vel = hold_dc;
0 commit comments