Reset PWM limit to maximum when reaching minimum

This commit is contained in:
Thomas Kolb 2016-08-22 21:09:41 +02:00
parent a17313246d
commit 11d0878864
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}
}