Removed need for abs()
This commit is contained in:
parent
1df58e9066
commit
32909f20be
@ -18,7 +18,7 @@ void Motor::SetSpeed(float targetSpeed) {
|
|||||||
bool Motor::Drive(float distance) {
|
bool Motor::Drive(float distance) {
|
||||||
if (!this->driving) {
|
if (!this->driving) {
|
||||||
this->startTime = time(NULL);
|
this->startTime = time(NULL);
|
||||||
this->targetDistance = abs(distance);
|
this->targetDistance = distance >= 0 ? distance : -distance;
|
||||||
this->driving = true;
|
this->driving = true;
|
||||||
}
|
}
|
||||||
double duration = difftime(time(NULL), this->startTime);
|
double duration = difftime(time(NULL), this->startTime);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user