File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -166,11 +166,13 @@ HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef *hadc)
166166 return HAL_ERROR ;
167167 }
168168 }
169-
170- calibration_factor_accumulated += LL_ADC_GetCalibrationFactor (hadc -> Instance );
169+ /* Read the calibration factor and increment by one */
170+ calibration_factor_accumulated += ( LL_ADC_GetCalibrationFactor (hadc -> Instance ) + 1UL );
171171 }
172- /* Compute average */
172+ /* Compute average (rounded up to the nearest integer) */
173+ calibration_factor_accumulated += (calibration_index / 2UL );
173174 calibration_factor_accumulated /= calibration_index ;
175+
174176 /* Apply calibration factor (requires ADC enable and disable process) */
175177 LL_ADC_Enable (hadc -> Instance );
176178
You can’t perform that action at this time.
0 commit comments