Skip to content

Commit

Permalink
Merge pull request FIRST-Tech-Challenge#4 from goBILDA-Official/Encod…
Browse files Browse the repository at this point in the history
…er-Direction-Bugfix

Encoder direction bugfix
  • Loading branch information
Ethan-goBILDA authored Oct 11, 2024
2 parents 36b3283 + 9a85c81 commit 3e5f47a
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,16 @@ public void setOffsets(double xOffset, double yOffset){
* @param yEncoder FORWARD or REVERSED, Y (strafe) pod should increase when the robot is moving left
*/
public void setEncoderDirections(EncoderDirection xEncoder, EncoderDirection yEncoder){
if (xEncoder == EncoderDirection.FORWARD){
writeInt(Register.DEVICE_CONTROL,1<<5);
}
if (xEncoder == EncoderDirection.REVERSED) {
writeInt(Register.DEVICE_CONTROL,1<<4);
}

if (yEncoder == EncoderDirection.FORWARD){
writeInt(Register.DEVICE_CONTROL,1<<3);
}
if (yEncoder == EncoderDirection.REVERSED){
writeInt(Register.DEVICE_CONTROL,1<<2);
}
Expand Down

0 comments on commit 3e5f47a

Please sign in to comment.