Skip to content

Commit ccf6d0c

Browse files
StefanKrupopjacobperron
authored andcommitted
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"
1 parent f9f3aa9 commit ccf6d0c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/create.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,15 @@ namespace create {
463463
sideMotorPower = roundf(side * 127);
464464
vacuumMotorPower = roundf(vacuum * 127);
465465

466+
if (model.getVersion() == V_1) {
467+
uint8_t cmd[2] = { OC_MOTORS,
468+
static_cast<uint8_t>((side != 0.0 ? 1 : 0) |
469+
(vacuum != 0.0 ? 2 : 0) |
470+
(main != 0.0 ? 4 : 0))
471+
};
472+
return serial->send(cmd, 2);
473+
}
474+
466475
uint8_t cmd[4] = { OC_MOTORS_PWM,
467476
mainMotorPower,
468477
sideMotorPower,

0 commit comments

Comments
 (0)