Feed mapAveragingAdcCallback() with volts not adc raw values (#4940)

This commit is contained in:
Andrey G 2023-01-05 20:14:48 +03:00 committed by GitHub
parent f25edb646d
commit a300043f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -125,11 +125,9 @@ void MapAverager::stop() {
* @note This method is invoked OFTEN, this method is a potential bottleneck - the implementation should be * @note This method is invoked OFTEN, this method is a potential bottleneck - the implementation should be
* as fast as possible * as fast as possible
*/ */
void mapAveragingAdcCallback(adcsample_t adcValue) { void mapAveragingAdcCallback(float instantVoltage) {
efiAssertVoid(CUSTOM_ERR_6650, getCurrentRemainingStack() > 128, "lowstck#9a"); efiAssertVoid(CUSTOM_ERR_6650, getCurrentRemainingStack() > 128, "lowstck#9a");
float instantVoltage = adcToVoltsDivided(adcValue);
SensorResult mapResult = getMapAvg(currentMapAverager).submit(instantVoltage); SensorResult mapResult = getMapAvg(currentMapAverager).submit(instantVoltage);
if (!mapResult) { if (!mapResult) {

View File

@ -12,7 +12,7 @@
#if EFI_MAP_AVERAGING #if EFI_MAP_AVERAGING
#if HAL_USE_ADC #if HAL_USE_ADC
void mapAveragingAdcCallback(adcsample_t newValue); void mapAveragingAdcCallback(float instantVoltage);
#endif #endif
void initMapAveraging(); void initMapAveraging();

View File

@ -185,7 +185,7 @@ void onFastAdcComplete(adcsample_t*) {
#endif /* EFI_SENSOR_CHART */ #endif /* EFI_SENSOR_CHART */
#if EFI_MAP_AVERAGING #if EFI_MAP_AVERAGING
mapAveragingAdcCallback(getFastAdc(fastMapSampleIndex)); mapAveragingAdcCallback(adcToVoltsDivided(getFastAdc(fastMapSampleIndex)));
#endif /* EFI_MAP_AVERAGING */ #endif /* EFI_MAP_AVERAGING */
#if EFI_HIP_9011 #if EFI_HIP_9011
if (engineConfiguration->isHip9011Enabled) { if (engineConfiguration->isHip9011Enabled) {