Skip to content

Commit 29fa119

Browse files
committed
carousel: add pin to unhome
Signed-off-by: andypugh <andy@bodgesoc.org>
1 parent 9471c05 commit 29fa119

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/hal/components/carousel.comp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@ pin out bit motor-rev "Indicates the motor should run reverse.";
131131
pin out bit parity-error "Indicates a parity error";
132132
pin out signed current-position "This pin indicates the current position feedback";
133133
pin 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

135137
param r signed state = 0 "Current component state";
136138
param 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";
138139
param r float timer "Shows the value of the internal timer";
139140
param r signed motor-dir "Internal tag for search direction";
140141

@@ -152,6 +153,7 @@ variable int inst_parity;
152153
variable int old_index = 0;
153154
variable int base_counts = 0;
154155
variable int target;
156+
variable int old_unhome = 0;
155157
function _ ;
156158

157159
include "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

Comments
 (0)