From 449ed4b0938801ebc4ef9810a3ff5d3e4f438f42 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Mon, 19 Apr 2021 02:29:20 -0400 Subject: [PATCH] Fix motor setting (#62) * Change 3 setAllMotor calls to use float parameter. * Use static_cast for proper conversion to float. --- src/create.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/create.cpp b/src/create.cpp index a4f966f..270e687 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -496,15 +496,15 @@ namespace create { } bool Create::setMainMotor(const float& main) { - return setAllMotors(main, sideMotorPower, vacuumMotorPower); + return setAllMotors(main, static_cast(sideMotorPower) / 127.0, static_cast(vacuumMotorPower) / 127.0); } bool Create::setSideMotor(const float& side) { - return setAllMotors(mainMotorPower, side, vacuumMotorPower); + return setAllMotors(static_cast(mainMotorPower) / 127.0, side, static_cast(vacuumMotorPower) / 127.0); } bool Create::setVacuumMotor(const float& vacuum) { - return setAllMotors(mainMotorPower, sideMotorPower, vacuum); + return setAllMotors(static_cast(mainMotorPower) / 127.0, static_cast(sideMotorPower) / 127.0, vacuum); } bool Create::updateLEDs() {