Fixed mppMaxPWM limits

This commit is contained in:
Thomas Kolb 2016-08-21 19:45:05 +02:00
parent 6fc5a0e2c9
commit a17313246d

View file

@ -731,7 +731,7 @@ int main(void)
timer_set_oc_value(TIM1, TIM_CH_CONV, pwm); timer_set_oc_value(TIM1, TIM_CH_CONV, pwm);
if((mpp_state.mppMaxPWM < CONV_PWM_MAX) && (mpp_state.mppMaxPWM > CONV_PWM_MAX/10) && if((mpp_state.mppMaxPWM < CONV_PWM_MAX) &&
time_in_state > 5000 && ((time_in_state % 3000) == 10)) { time_in_state > 5000 && ((time_in_state % 3000) == 10)) {
mpp_state.mppMaxPWM++; mpp_state.mppMaxPWM++;
} }
@ -740,7 +740,10 @@ int main(void)
operState = Bootstrap; operState = Bootstrap;
nextState = ConvMPP; nextState = ConvMPP;
mpp_state.testIdx = -1; mpp_state.testIdx = -1;
mpp_state.mppMaxPWM -= 10;
if(mpp_state.mppMaxPWM > CONV_PWM_MAX/10) {
mpp_state.mppMaxPWM -= 10;
}
} }
if(power_state.vout_avg > MAX_VOLTAGE) { if(power_state.vout_avg > MAX_VOLTAGE) {