From f8858b952efa3bd9bdfcd2b45a9e4444bc2cbcbf Mon Sep 17 00:00:00 2001 From: Neil McKechnie Date: Fri, 27 Aug 2021 16:59:04 +0100 Subject: [PATCH] Servo positioning - correct handling of profile 0. Ensure that profile 0 uses the duration parameter to calculate the number of steps. --- IO_PCA9685.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IO_PCA9685.cpp b/IO_PCA9685.cpp index 1b7436d..79c022c 100644 --- a/IO_PCA9685.cpp +++ b/IO_PCA9685.cpp @@ -161,8 +161,7 @@ void PCA9685::_writeAnalogue(VPIN vpin, int value, uint8_t profile, uint16_t dur // Animated profile. Initiate the appropriate action. s->currentProfile = profile; uint8_t profileValue = profile & ~NoPowerOff; // Mask off 'don't-power-off' bit. - s->numSteps = profileValue==Instant ? 1 : - profileValue==Fast ? 10 : // 0.5 seconds + s->numSteps = profileValue==Fast ? 10 : // 0.5 seconds profileValue==Medium ? 20 : // 1.0 seconds profileValue==Slow ? 40 : // 2.0 seconds profileValue==Bounce ? sizeof(_bounceProfile)-1 : // ~ 1.5 seconds