Skip to content

Commit

Permalink
Add setDirection() to Encoder interface (fixes FIRST-Tech-Challenge#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrott committed Feb 2, 2023
1 parent 970625f commit 8a88605
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.firstinspires.ftc.teamcode.util;

import com.qualcomm.robotcore.hardware.DcMotorController;
import com.qualcomm.robotcore.hardware.DcMotorSimple;

public interface Encoder {
class PositionVelocityPair {
Expand All @@ -15,4 +16,6 @@ public PositionVelocityPair(int position, int velocity) {
PositionVelocityPair getPositionAndVelocity();

DcMotorController getController();

void setDirection(DcMotorSimple.Direction direction);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.firstinspires.ftc.teamcode.util;

import com.qualcomm.robotcore.hardware.DcMotorController;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.util.ElapsedTime;

public final class OverflowEncoder implements Encoder {
Expand Down Expand Up @@ -54,4 +55,9 @@ public PositionVelocityPair getPositionAndVelocity() {
public DcMotorController getController() {
return encoder.getController();
}

@Override
public void setDirection(DcMotorSimple.Direction direction) {
encoder.setDirection(direction);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ public PositionVelocityPair getPositionAndVelocity() {
public DcMotorController getController() {
return m.getController();
}

@Override
public void setDirection(DcMotorSimple.Direction direction) {
this.direction = direction;
}
}

0 comments on commit 8a88605

Please sign in to comment.