Use OC_MOTORS instead of OC_MOTORS_PWM on V_1 models (#55)

SCI for older Roombas (V_1) did not include OC_MOTORS_PWM, but only OC_MOTORS. Use that instead of OC_MOTORS_PWM for V_1, interpeting values != 0 as "on"
This commit is contained in:
Stefan Krupop 2019-12-04 01:20:35 +01:00 committed by Jacob Perron
parent f9f3aa9d3d
commit ccf6d0cdc0

View file

@ -463,6 +463,15 @@ namespace create {
sideMotorPower = roundf(side * 127);
vacuumMotorPower = roundf(vacuum * 127);
if (model.getVersion() == V_1) {
uint8_t cmd[2] = { OC_MOTORS,
static_cast<uint8_t>((side != 0.0 ? 1 : 0) |
(vacuum != 0.0 ? 2 : 0) |
(main != 0.0 ? 4 : 0))
};
return serial->send(cmd, 2);
}
uint8_t cmd[4] = { OC_MOTORS_PWM,
mainMotorPower,
sideMotorPower,