Add static cast to fix compiler warnings

Signed-off-by: Jacob Perron <jacobmperron@gmail.com>
This commit is contained in:
Jacob Perron 2019-03-26 22:03:10 -07:00
parent 4d9f0e891a
commit 4e8d497024

View file

@ -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<uint8_t>(vel_mm >> 8),
static_cast<uint8_t>(vel_mm & 0xff),
static_cast<uint8_t>(radius_mm >> 8),
static_cast<uint8_t>(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<uint8_t>(rightCmd >> 8),
static_cast<uint8_t>(rightCmd & 0xff),
static_cast<uint8_t>(leftCmd >> 8),
static_cast<uint8_t>(leftCmd & 0xff)
};
return serial->send(cmd, 5);
} else {
@ -439,10 +439,10 @@ 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<uint8_t>(rightPwm >> 8),
static_cast<uint8_t>(rightPwm & 0xff),
static_cast<uint8_t>(leftPwm >> 8),
static_cast<uint8_t>(leftPwm & 0xff)
};
return serial->send(cmd, 5);