From 3cdbcc59807a3dd4d30883d24986af6bc64e59d8 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 6 Aug 2017 16:29:14 -0400 Subject: [PATCH] #470 --- firmware/controllers/map_averaging.cpp | 5 +++-- firmware/controllers/sensors/map.cpp | 8 ++++++-- firmware/rusefi.cpp | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/firmware/controllers/map_averaging.cpp b/firmware/controllers/map_averaging.cpp index 06495ab5c3..e34004c499 100644 --- a/firmware/controllers/map_averaging.cpp +++ b/firmware/controllers/map_averaging.cpp @@ -84,7 +84,7 @@ static float v_averagedMapValue; #define MAX_MAP_BUFFER_LENGTH (INJECTION_PIN_COUNT * 2) // in MAP units, not voltage! static float averagedMapRunningBuffer[MAX_MAP_BUFFER_LENGTH]; -static int mapMinBufferLength = 0; +int mapMinBufferLength = 0; static int averagedMapBufIdx = 0; // this is 'minimal averaged' MAP static float currentPressure; @@ -213,7 +213,8 @@ static void mapAveragingCallback(trigger_event_e ckpEventType, return; } - if (boardConfiguration->mapMinBufferLength != mapMinBufferLength) { + // 'mapMinBufferLength == 0' means not initialized + if (boardConfiguration->mapMinBufferLength != mapMinBufferLength || mapMinBufferLength == 0) { // check range mapMinBufferLength = maxI(minI(boardConfiguration->mapMinBufferLength, MAX_MAP_BUFFER_LENGTH), 1); // reset index diff --git a/firmware/controllers/sensors/map.cpp b/firmware/controllers/sensors/map.cpp index 8cbaa13d1c..a8f181a844 100644 --- a/firmware/controllers/sensors/map.cpp +++ b/firmware/controllers/sensors/map.cpp @@ -187,6 +187,9 @@ static void digitalMapWidthCallback(void) { } #if EFI_PROD_CODE || defined(__DOXYGEN__) + +extern int mapMinBufferLength; + static void printMAPInfo(void) { #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) scheduleMsg(logger, "instant value=%fkPa", getRawMap()); @@ -195,9 +198,10 @@ static void printMAPInfo(void) { if (engineConfiguration->hasFrequencyReportingMapSensor) { scheduleMsg(logger, "instant value=%fHz @ %s", mapFreq, hwPortname(boardConfiguration->frequencyReportingMapInputPin)); } else { - scheduleMsg(logger, "map type=%d/%s MAP=%fkPa", engineConfiguration->map.sensor.type, + scheduleMsg(logger, "map type=%d/%s MAP=%fkPa mapMinBufferLength=%d", engineConfiguration->map.sensor.type, getAir_pressure_sensor_type_e(engineConfiguration->map.sensor.type), - getMap()); + getMap(), + mapMinBufferLength); adc_channel_e mapAdc = engineConfiguration->map.sensor.hwChannel; static char pinNameBuffer[16]; diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 39404988dc..5c77879591 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -260,5 +260,5 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20170802; + return 20170806; }