From 4e8d49702434de952daa19bf9b4a3904b15cea68 Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Tue, 26 Mar 2019 22:03:10 -0700 Subject: [PATCH] Add static cast to fix compiler warnings Signed-off-by: Jacob Perron --- src/create.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/create.cpp b/src/create.cpp index 2e00cf1..eacc608 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -370,10 +370,10 @@ namespace create { } uint8_t cmd[5] = { OC_DRIVE, - vel_mm >> 8, - vel_mm & 0xff, - radius_mm >> 8, - radius_mm & 0xff + static_cast(vel_mm >> 8), + static_cast(vel_mm & 0xff), + static_cast(radius_mm >> 8), + static_cast(radius_mm & 0xff) }; return serial->send(cmd, 5); @@ -389,10 +389,10 @@ namespace create { int16_t rightCmd = roundf(boundedRightVel * 1000); uint8_t cmd[5] = { OC_DRIVE_DIRECT, - rightCmd >> 8, - rightCmd & 0xff, - leftCmd >> 8, - leftCmd & 0xff + static_cast(rightCmd >> 8), + static_cast(rightCmd & 0xff), + static_cast(leftCmd >> 8), + static_cast(leftCmd & 0xff) }; return serial->send(cmd, 5); } else { @@ -439,11 +439,11 @@ namespace create { int16_t rightPwm = roundf(rightWheel * PWM_COUNTS); uint8_t cmd[5] = { OC_DRIVE_PWM, - rightPwm >> 8, - rightPwm & 0xff, - leftPwm >> 8, - leftPwm & 0xff - }; + static_cast(rightPwm >> 8), + static_cast(rightPwm & 0xff), + static_cast(leftPwm >> 8), + static_cast(leftPwm & 0xff) + }; return serial->send(cmd, 5); } @@ -466,10 +466,10 @@ namespace create { vacuumMotorPower = roundf(vacuum * 127); uint8_t cmd[4] = { OC_MOTORS_PWM, - mainMotorPower, - sideMotorPower, - vacuumMotorPower - }; + mainMotorPower, + sideMotorPower, + vacuumMotorPower + }; return serial->send(cmd, 4); } @@ -489,10 +489,10 @@ namespace create { bool Create::updateLEDs() { uint8_t LEDByte = debrisLED + spotLED + dockLED + checkLED; uint8_t cmd[4] = { OC_LEDS, - LEDByte, - powerLED, - powerLEDIntensity - }; + LEDByte, + powerLED, + powerLEDIntensity + }; return serial->send(cmd, 4); }