Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSDK-8836: Gantry Can't Home with Limit Switches #4383

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions components/gantry/singleaxis/singleaxis.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,20 +442,22 @@ func (g *singleAxis) testLimit(ctx context.Context, pin int) (float64, error) {
break
}

// check if the wrong limit switch was hit
wrongHit, err := g.limitHit(ctx, wrongPin)
if err != nil {
return 0, err
}
if wrongHit {
err = g.motor.Stop(ctx, nil)
if len(g.limitSwitchPins) > 1 {
// check if the wrong limit switch was hit
wrongHit, err := g.limitHit(ctx, wrongPin)
if err != nil {
return 0, err
}
return 0, errors.Errorf(
"expected limit switch %v but hit limit switch %v, try switching the order in the config",
pin,
wrongPin)
if wrongHit {
err = g.motor.Stop(ctx, nil)
if err != nil {
return 0, err
}
return 0, errors.Errorf(
"expected limit switch %v but hit limit switch %v, try switching the order in the config",
pin,
wrongPin)
}
}

elapsed := time.Since(start)
Expand Down
Loading