progress #568
This commit is contained in:
parent
d3a0296858
commit
c3ef3d09cc
|
@ -180,18 +180,22 @@ static void endAveraging(void *arg) {
|
||||||
isAveraging = false;
|
isAveraging = false;
|
||||||
// with locking we would have a consistent state
|
// with locking we would have a consistent state
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
v_averagedMapValue = adcToVoltsDivided(mapAdcAccumulator / mapMeasurementsCounter);
|
if (mapMeasurementsCounter > 0) {
|
||||||
// todo: move out of locked context?
|
v_averagedMapValue = adcToVoltsDivided(mapAdcAccumulator / mapMeasurementsCounter);
|
||||||
averagedMapRunningBuffer[averagedMapBufIdx] = getMapByVoltage(v_averagedMapValue);
|
// todo: move out of locked context?
|
||||||
// increment circular running buffer index
|
averagedMapRunningBuffer[averagedMapBufIdx] = getMapByVoltage(v_averagedMapValue);
|
||||||
averagedMapBufIdx = (averagedMapBufIdx + 1) % mapMinBufferLength;
|
// increment circular running buffer index
|
||||||
// find min. value (only works for pressure values, not raw voltages!)
|
averagedMapBufIdx = (averagedMapBufIdx + 1) % mapMinBufferLength;
|
||||||
float minPressure = averagedMapRunningBuffer[0];
|
// find min. value (only works for pressure values, not raw voltages!)
|
||||||
for (int i = 1; i < mapMinBufferLength; i++) {
|
float minPressure = averagedMapRunningBuffer[0];
|
||||||
if (averagedMapRunningBuffer[i] < minPressure)
|
for (int i = 1; i < mapMinBufferLength; i++) {
|
||||||
minPressure = averagedMapRunningBuffer[i];
|
if (averagedMapRunningBuffer[i] < minPressure)
|
||||||
|
minPressure = averagedMapRunningBuffer[i];
|
||||||
|
}
|
||||||
|
currentPressure = minPressure;
|
||||||
|
} else {
|
||||||
|
warning(CUSTOM_ERR_6548, "No MAP values");
|
||||||
}
|
}
|
||||||
currentPressure = minPressure;
|
|
||||||
#endif
|
#endif
|
||||||
if (!wasLocked)
|
if (!wasLocked)
|
||||||
unlockAnyContext();
|
unlockAnyContext();
|
||||||
|
|
|
@ -276,5 +276,5 @@ int getRusEfiVersion(void) {
|
||||||
if (initBootloader() != 0)
|
if (initBootloader() != 0)
|
||||||
return 123;
|
return 123;
|
||||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||||
return 20180207;
|
return 20180210;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue