diff --git a/Motor.cpp b/Motor.cpp index 76f8646..8151321 100644 --- a/Motor.cpp +++ b/Motor.cpp @@ -1,18 +1,18 @@ #include "Motor.h" #include -#include +// #include Motor::Motor() { type = Type::Motor; } float Motor::GetSpeed() { - return this->currentSpeed; + return this->currentTargetSpeed; } -void Motor::SetSpeed(float speed) { - this->currentSpeed = speed; +void Motor::SetSpeed(float targetSpeed) { + this->currentTargetSpeed = targetSpeed; } bool Motor::Drive(float distance) { diff --git a/Motor.h b/Motor.h index f322ee9..8403875 100644 --- a/Motor.h +++ b/Motor.h @@ -10,18 +10,25 @@ class Motor : public Thing { public: Motor(); /// @brief Turning direction of the motor - enum Direction { Forward = 1, Reverse = -1 }; - /// @brief Set the turning direction of the motor - // void SetDirection(Direction direction); + /// @brief Motor turning direction + enum class Direction { Clockwise = 1, CounterClockwise = -1 }; + /// @brief The forward turning direction of the motor + Direction direction = Direction::Clockwise; + /// @brief Set the target motor speed + /// @param speed The speed between -1 (full backward), 0 (stop) and 1 (full + /// forward) virtual void SetSpeed(float speed); - float GetSpeed(); + /// @brief Get the current target speed of the motor + /// @return The speed between -1 (full backward), 0 (stop) and 1 (full + /// forward) + virtual float GetSpeed(); bool Drive(float distance); protected: - float currentSpeed = 0; + float currentTargetSpeed = 0; bool driving = false; float targetDistance = 0; time_t startTime = 0; diff --git a/VectorAlgebra b/VectorAlgebra index 80c89a8..493a3f7 160000 --- a/VectorAlgebra +++ b/VectorAlgebra @@ -1 +1 @@ -Subproject commit 80c89a8232aa77cabaee9f739ef6fdd3e5508260 +Subproject commit 493a3f748907b4fb7e64177f94b7cb98a951af4c