Skip to content

Commit

Permalink
Fix pros 4.0.6 build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SizzinSeal committed Oct 18, 2023
1 parent 5c7f82c commit 66205b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lemlib/devices/encoder/rotation.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <cmath>
#include "lemlib/util.hpp"
#include "lemlib/devices/encoder/rotation.hpp"

/**
Expand All @@ -7,9 +8,12 @@
* This is a class derived from the Encoder class.
* This abstraction is pretty easy because there is only 1 sensor that needs
* to be checked.
*
* Because of a missing parameter in the rotation sensor constructor, we have to do
* some wacky stuff in the constructor so our users still have the choice of a flag
*/
lemlib::RotationEncoder::RotationEncoder(int port, bool reversed, float ratio)
: rotation(pros::Rotation(port, reversed)),
: rotation(pros::Rotation(int(port) * sgn(float(!reversed) - 0.1))),
ratio(ratio) {}

/**
Expand Down

0 comments on commit 66205b6

Please sign in to comment.