From 1439dfd912c284aaed35eed7d211d34d3aaec4fa Mon Sep 17 00:00:00 2001 From: Galdor Takacs Date: Thu, 1 Sep 2022 22:30:29 +0200 Subject: [PATCH] motorController: Fix infinite vibration on RunForDuration(0) --- src/components/motor/MotorController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index 90e41d20..db6103f4 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -19,7 +19,7 @@ void MotorController::Ring(TimerHandle_t xTimer) { } 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); } }