Skip to content

Commit 449ed4b

Browse files
authored
Fix motor setting (#62)
* Change 3 setAllMotor calls to use float parameter. * Use static_cast for proper conversion to float.
1 parent 20ed0b1 commit 449ed4b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/create.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,15 +496,15 @@ namespace create {
496496
}
497497

498498
bool Create::setMainMotor(const float& main) {
499-
return setAllMotors(main, sideMotorPower, vacuumMotorPower);
499+
return setAllMotors(main, static_cast<float>(sideMotorPower) / 127.0, static_cast<float>(vacuumMotorPower) / 127.0);
500500
}
501501

502502
bool Create::setSideMotor(const float& side) {
503-
return setAllMotors(mainMotorPower, side, vacuumMotorPower);
503+
return setAllMotors(static_cast<float>(mainMotorPower) / 127.0, side, static_cast<float>(vacuumMotorPower) / 127.0);
504504
}
505505

506506
bool Create::setVacuumMotor(const float& vacuum) {
507-
return setAllMotors(mainMotorPower, sideMotorPower, vacuum);
507+
return setAllMotors(static_cast<float>(mainMotorPower) / 127.0, static_cast<float>(sideMotorPower) / 127.0, vacuum);
508508
}
509509

510510
bool Create::updateLEDs() {

0 commit comments

Comments
 (0)