Removed need for abs()

This commit is contained in:
Pascal Serrarens 2023-11-28 16:01:47 +01:00
parent 1df58e9066
commit 32909f20be

View File

@ -18,7 +18,7 @@ void Motor::SetSpeed(float targetSpeed) {
bool Motor::Drive(float distance) {
if (!this->driving) {
this->startTime = time(NULL);
this->targetDistance = abs(distance);
this->targetDistance = distance >= 0 ? distance : -distance;
this->driving = true;
}
double duration = difftime(time(NULL), this->startTime);