motorController: Fix infinite vibration on RunForDuration(0)

This commit is contained in:
Galdor Takacs 2022-09-01 22:30:29 +02:00 committed by JF
parent 60abbf0639
commit 1439dfd912

View File

@ -19,7 +19,7 @@ void MotorController::Ring(TimerHandle_t xTimer) {
} }
void MotorController::RunForDuration(uint8_t motorDuration) { 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); nrf_gpio_pin_clear(PinMap::Motor);
} }
} }