diff --git a/.changesets/encoder-none.md b/.changesets/encoder-none.md new file mode 100644 index 000000000..1a83c27ad --- /dev/null +++ b/.changesets/encoder-none.md @@ -0,0 +1,4 @@ +release: none +summary: Clean up internal encoder sensor formatting + +No public behavior or API changed in this update. diff --git a/Inc/ST-LIB_LOW/Sensors/EncoderSensor/NewEncoderSensor.hpp b/Inc/ST-LIB_LOW/Sensors/EncoderSensor/NewEncoderSensor.hpp index 7bcf98eb7..52bc7259a 100644 --- a/Inc/ST-LIB_LOW/Sensors/EncoderSensor/NewEncoderSensor.hpp +++ b/Inc/ST-LIB_LOW/Sensors/EncoderSensor/NewEncoderSensor.hpp @@ -9,9 +9,8 @@ #include "C++Utilities/CppUtils.hpp" namespace ST_LIB { - +enum Direction : uint8_t { FORWARD = 0, BACKWARDS = 1 }; template struct EncoderSensor { - enum Direction : uint8_t { FORWARD = 0, BACKWARDS = 1 }; private: constexpr static size_t WINDOW_SIZE{(SAMPLES / 2) * 2}; diff --git a/Tests/Time/encoder_test.cpp b/Tests/Time/encoder_test.cpp index eaf3b8b13..057e05e4e 100644 --- a/Tests/Time/encoder_test.cpp +++ b/Tests/Time/encoder_test.cpp @@ -103,7 +103,7 @@ TEST(EncoderSensorTest, ReadTreatsEncoderInitialCounterAsZeroPosition) { double position = -1.0; double speed = -1.0; double acceleration = -1.0; - MockSensor::Direction direction = MockSensor::BACKWARDS; + ST_LIB::Direction direction = ST_LIB::Direction::BACKWARDS; MockSensor sensor(encoder, 0.5, 0.1, &direction, &position, &speed, &acceleration); @@ -112,7 +112,7 @@ TEST(EncoderSensorTest, ReadTreatsEncoderInitialCounterAsZeroPosition) { EXPECT_DOUBLE_EQ(position, 0.0); EXPECT_DOUBLE_EQ(speed, 0.0); EXPECT_DOUBLE_EQ(acceleration, 0.0); - EXPECT_EQ(direction, MockSensor::FORWARD); + EXPECT_EQ(direction, ST_LIB::Direction::FORWARD); } TEST(EncoderSensorTest, ResetForwardsToEncoderAndClearsHistory) { @@ -122,7 +122,7 @@ TEST(EncoderSensorTest, ResetForwardsToEncoderAndClearsHistory) { double position = 0.0; double speed = 0.0; double acceleration = 0.0; - MockSensor::Direction direction = MockSensor::BACKWARDS; + ST_LIB::Direction direction = ST_LIB::Direction::BACKWARDS; MockSensor sensor(encoder, 1.0, 1.0, &direction, &position, &speed, &acceleration);