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
1 changed files with 4 additions and 2 deletions

View File

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