From 11d0878864c3a1a7abfeb492e80ebcff83403cbb Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Mon, 22 Aug 2016 21:09:41 +0200 Subject: [PATCH] Reset PWM limit to maximum when reaching minimum --- src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 4686c2d..2510f37 100644 --- a/src/main.c +++ b/src/main.c @@ -741,8 +741,11 @@ int main(void) nextState = ConvMPP; mpp_state.testIdx = -1; - if(mpp_state.mppMaxPWM > CONV_PWM_MAX/10) { + if(mpp_state.mppMaxPWM > CONV_PWM_MAX/50) { mpp_state.mppMaxPWM -= 10; + } else { + // limit has gone too low -> retry at maximum + mpp_state.mppMaxPWM = CONV_PWM_MAX; } }