Author: Galdor Takacs <g@ldor.de>
motorController: Fix infinite vibration on RunForDuration(0)
src/components/motor/MotorController.cpp | 2 +-
diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index 90e41d203ff930f2f9263793721134e760aa4636..db6103f42427b2c7c5eadb63861560214e71dcbd 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -19,7 +19,7 @@ motorController->RunForDuration(50); } void MotorController::RunForDuration(uint8_t motorDuration) { - if (xTimerChangePeriod(shortVib, pdMS_TO_TICKS(motorDuration), 0) == pdPASS && xTimerStart(shortVib, 0) == pdPASS) { + if (motorDuration > 0 && xTimerChangePeriod(shortVib, pdMS_TO_TICKS(motorDuration), 0) == pdPASS && xTimerStart(shortVib, 0) == pdPASS) { nrf_gpio_pin_clear(PinMap::Motor); } }