only:Some sort of AFR smoothing for some reason #6579
This commit is contained in:
parent
aa9eec47b0
commit
37085b9196
|
@ -37,6 +37,7 @@ Release template (copy/paste this for new release):
|
|||
- Allow to choose lower RPM cutoff for AC Compressor #6597
|
||||
- New TPS/TPS enrichment mode: percent adder #3167
|
||||
- Launch control has a variable ignition cut BEFORE the main Hard cut #6566
|
||||
- Experimental mapExpAverageAlpha filtering #6579
|
||||
|
||||
### Fixed
|
||||
- knock logic not activated until any configuration change via TS #6462
|
||||
|
|
|
@ -546,6 +546,9 @@ bool validateConfigOnStartUpOrBurn() {
|
|||
criticalError("Invalid adcVcc: %f", engineConfiguration->adcVcc);
|
||||
return false;
|
||||
}
|
||||
if (engineConfiguration->mapExpAverageAlpha <= 0 || engineConfiguration->mapExpAverageAlpha > 1) {
|
||||
engineConfiguration->mapExpAverageAlpha = 1;
|
||||
}
|
||||
|
||||
ensureArrayIsAscending("Batt Lag", engineConfiguration->injector.battLagCorrBins);
|
||||
|
||||
|
|
|
@ -97,6 +97,17 @@ SensorResult MapAverager::submit(float volts) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PUBLIC_API_WEAK float filterMapValue(float value) {
|
||||
static float state = 0;
|
||||
if (state == 0) {
|
||||
state = value;
|
||||
return value;
|
||||
}
|
||||
float result = state + engineConfiguration->mapExpAverageAlpha * (value - state);
|
||||
state = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
void MapAverager::stop() {
|
||||
chibios_rt::CriticalSectionLocker csl;
|
||||
|
||||
|
@ -117,7 +128,7 @@ void MapAverager::stop() {
|
|||
minPressure = averagedMapRunningBuffer[i];
|
||||
}
|
||||
|
||||
setValidValue(minPressure, getTimeNowNt());
|
||||
setValidValue(filterMapValue(minPressure), getTimeNowNt());
|
||||
} else {
|
||||
#if EFI_PROD_CODE
|
||||
warning(ObdCode::CUSTOM_UNEXPECTED_MAP_VALUE, "No MAP values to average");
|
||||
|
|
|
@ -988,7 +988,7 @@ bit verboseCan2,"Print all","Do not print";Print incoming and outgoing second bu
|
|||
int launchSpeedThreshold;Launch disabled above this speed if setting is above zero;"Kph", 1, 0, 0, 300, 0
|
||||
int launchRpmWindow;Starting Launch RPM window to activate (subtracts from Launch RPM);"RPM", 1, 0, 0, 8000, 0
|
||||
float triggerEventsTimeoutMs;;"ms", 1, 0, 0, 3000, 3
|
||||
int unusedHere13
|
||||
float mapExpAverageAlpha;;"", 1, 0, 0, 3000, 3
|
||||
float magicNumberAvailableForDevTricks
|
||||
float turbochargerFilter
|
||||
int launchTpsThreshold;;"", 1, 0, 0, 20000, 0
|
||||
|
|
|
@ -3444,6 +3444,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
|
|||
field = ""
|
||||
field = "Measure Map Only In One Cylinder", measureMapOnlyInOneCylinder
|
||||
field = "Cylinder count to sample MAP", mapMinBufferLength
|
||||
field = mapExpAverageAlpha, mapExpAverageAlpha
|
||||
|
||||
dialog = mapSettings, "", yAxis
|
||||
panel = mapCommon
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#include "pch.h"
|
||||
|
||||
extern float filterMapValue(float value);
|
||||
|
||||
TEST(average, exp) {
|
||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||
ASSERT_EQ(filterMapValue(0), 0);
|
||||
|
||||
engineConfiguration->mapExpAverageAlpha = 0.5;
|
||||
|
||||
|
||||
ASSERT_EQ(filterMapValue(3), 3); // this would start collecting
|
||||
ASSERT_EQ(filterMapValue(1), 2);
|
||||
ASSERT_EQ(filterMapValue(3), 2.5);
|
||||
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ CPPSRC += $(PROJECT_DIR)/../unit_tests/tests/util/test_buffered_writer.cpp \
|
|||
$(PROJECT_DIR)/../unit_tests/tests/util/test_closed_loop_controller.cpp \
|
||||
$(PROJECT_DIR)/../unit_tests/tests/util/test_scaled_channel.cpp \
|
||||
$(PROJECT_DIR)/../unit_tests/tests/util/test_timer.cpp \
|
||||
$(PROJECT_DIR)/../unit_tests/tests/util/test_averaging.cpp \
|
||||
$(PROJECT_DIR)/../unit_tests/tests/util/test_lua_biquad.cpp \
|
||||
$(PROJECT_DIR)/../unit_tests/tests/util/test_hash.cpp \
|
||||
|
||||
|
|
Loading…
Reference in New Issue