hopefully #568 fix

This commit is contained in:
rusefi 2018-02-07 08:12:34 +03:00
parent c990cfb8ef
commit d3a0296858
2 changed files with 8 additions and 4 deletions

View File

@ -86,8 +86,11 @@ static float v_averagedMapValue;
static float averagedMapRunningBuffer[MAX_MAP_BUFFER_LENGTH]; static float averagedMapRunningBuffer[MAX_MAP_BUFFER_LENGTH];
int mapMinBufferLength = 0; int mapMinBufferLength = 0;
static int averagedMapBufIdx = 0; static int averagedMapBufIdx = 0;
// this is 'minimal averaged' MAP // we need this 'NO_VALUE_YET' to properly handle transition from engine not running to engine already running
static float currentPressure; // but prior to first processed result
#define NO_VALUE_YET -100
// this is 'minimal averaged' MAP within avegaging window
static float currentPressure = NO_VALUE_YET;
EXTERN_ENGINE EXTERN_ENGINE
; ;
@ -210,6 +213,7 @@ static void applyMapMinBufferLength() {
void postMapState(TunerStudioOutputChannels *tsOutputChannels) { void postMapState(TunerStudioOutputChannels *tsOutputChannels) {
tsOutputChannels->debugFloatField1 = v_averagedMapValue; tsOutputChannels->debugFloatField1 = v_averagedMapValue;
tsOutputChannels->debugFloatField2 = engine->engineState.mapAveragingDuration; tsOutputChannels->debugFloatField2 = engine->engineState.mapAveragingDuration;
tsOutputChannels->debugFloatField3 = currentPressure;
tsOutputChannels->debugIntField1 = mapMeasurementsCounter; tsOutputChannels->debugIntField1 = mapMeasurementsCounter;
} }
@ -309,7 +313,7 @@ float getMap(void) {
} }
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
if (!isValidRpm(engine->rpmCalculator.rpmValue)) if (!isValidRpm(engine->rpmCalculator.rpmValue) || currentPressure == NO_VALUE_YET)
return validateMap(getRawMap()); // maybe return NaN in case of stopped engine? return validateMap(getRawMap()); // maybe return NaN in case of stopped engine?
return validateMap(currentPressure); return validateMap(currentPressure);
#else #else

View File

@ -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 20180204; return 20180207;
} }