Slower transition from CV voltage to FLT voltage

This commit is contained in:
Thomas Kolb 2020-05-01 00:08:11 +02:00
parent 1d5b7e74ff
commit c87a72f988

View file

@ -28,6 +28,8 @@
#define ADC_VALUE_AT_ZERO_CURRENT 90
#define TIME_FROM_CV_TO_FLT 300000
enum OperState {
Bootstrap,
ConvConstVoltage,
@ -848,10 +850,10 @@ int main(void)
break;
case ConvFloat:
if(time_in_state < 120000) {
if(time_in_state < TIME_FROM_CV_TO_FLT) {
setPoint =
fxp_add(CONST_VOLTAGE,
fxp_mult(fxp_sub(CONST_FLOAT_VOLTAGE, CONST_VOLTAGE), fxp_div(time_in_state, 120000)));
fxp_mult(fxp_sub(CONST_FLOAT_VOLTAGE, CONST_VOLTAGE), fxp_div(time_in_state, TIME_FROM_CV_TO_FLT)));
} else {
setPoint = CONST_FLOAT_VOLTAGE;
}