From ccf6d0cdc0e97d7abf170def16b0746d89b5274c Mon Sep 17 00:00:00 2001 From: Stefan Krupop Date: Wed, 4 Dec 2019 01:20:35 +0100 Subject: [PATCH] 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" --- src/create.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/create.cpp b/src/create.cpp index 10846e5..a0f9da6 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -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((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,