Skip to content

Commit

Permalink
carousel: Fix jogging in counts mode
Browse files Browse the repository at this point in the history
The comp was incrementing the target pocket, but not the counts needed to
get there.
Fixes #2300
  • Loading branch information
andypugh committed Oct 4, 2023
1 parent cf8cfc1 commit 7f6ca7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hal/components/carousel.comp
Expand Up @@ -147,6 +147,7 @@ param r float timer "Shows the value of the internal timer";
param r signed motor-dir "Internal tag for search direction";
param r signed counts-offset "Internal offset of index pin";
param rw unsigned debounce "How many thread cycles to wait for the position to stabilise";
param r signed target "Current target pocket, debug";

option count_function;
option extra_setup;
Expand All @@ -161,7 +162,6 @@ variable int inst_code;
variable int inst_parity;
variable int old_index = 0;
param r signed base_counts = 0;
variable int target;
variable int old_unhome = 0;
function _ ;

Expand Down Expand Up @@ -315,6 +315,7 @@ FUNCTION(_){
break;
}
target = current_position + jog_fwd - jog_rev;
counts_target += scale * (target - current_position);
if (target > inst_pockets ) target = 1;
if (target < 1) target = inst_pockets;
if (jog_fwd){
Expand Down

0 comments on commit 7f6ca7a

Please sign in to comment.