diff --git a/.changesets/archive/v5.1.0/encoder-minor.md b/.changesets/archive/v5.1.0/encoder-minor.md new file mode 100644 index 000000000..488ec206f --- /dev/null +++ b/.changesets/archive/v5.1.0/encoder-minor.md @@ -0,0 +1,2 @@ +release: minor +summary: Moved enum Direction to namespace ST-LIB, added more regex to cmake. 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);