mirror of https://github.com/rusefi/rusefi-1.git
parent
e82127b385
commit
2f45ed205c
|
@ -111,7 +111,7 @@ void mapAveragingAdcCallback(adcsample_t adcValue) {
|
|||
if (engineConfiguration->vvtMode[0] == VVT_MAP_V_TWIN &&
|
||||
((fastMapCounter++ % engineConfiguration->mapCamSkipFactor) == 0)) {
|
||||
engine->triggerCentral.mapState.add(instantMap);
|
||||
bool isPeak = engine->triggerCentral.mapState.isPeak();
|
||||
bool isPeak = engine->triggerCentral.mapState.isPeak(engineConfiguration->mapCamLookForLowPeaks);
|
||||
#if EFI_TUNER_STUDIO
|
||||
tsOutputChannels.TEMPLOG_map_length = MAP_CAM_BUFFER;
|
||||
tsOutputChannels.TEMPLOG_MAP_INSTANT_AVERAGE = engine->triggerCentral.mapState.current;
|
||||
|
|
|
@ -48,8 +48,12 @@ struct MapState {
|
|||
current = mapBuffer.sum(engineConfiguration->mapCamAveragingLength);
|
||||
}
|
||||
|
||||
bool isPeak() {
|
||||
return previous > prevPrevious && previous >= current;
|
||||
bool isPeak(bool lookForLowPeak) {
|
||||
if (lookForLowPeak) {
|
||||
return previous < prevPrevious && previous <= current;
|
||||
} else {
|
||||
return previous > prevPrevious && previous >= current;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -893,7 +893,7 @@ custom maf_sensor_type_e 4 bits, S32, @OFFSET@, [0:1], @@maf_sensor_type_e_enum@
|
|||
bit enableInnovateLC2
|
||||
bit showHumanReadableWarning
|
||||
bit stftIgnoreErrorMagnitude;+If enabled, adjust at a constant rate instead of a rate proportional to the current lambda error. This mode may be easier to tune, and more tolerant of sensor noise. Use of this mode is required if you have a narrowband O2 sensor.
|
||||
bit unused976b11
|
||||
bit mapCamLookForLowPeaks
|
||||
bit enableSoftwareKnock
|
||||
bit verboseVVTDecoding;enable vvt_details
|
||||
bit invertCamVVTSignal;get invertCamVVTSignal
|
||||
|
|
|
@ -3401,6 +3401,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
|||
field = "mapCamDetectionThreshold", mapCamDetectionThreshold
|
||||
field = "mapCamAveragingLength", mapCamAveragingLength
|
||||
field = "mapCamSkipFactor", mapCamSkipFactor
|
||||
field = "mapCamLookForLowPeaks", mapCamLookForLowPeaks
|
||||
field = "#System hacks"
|
||||
field = "Global fuel correction", globalFuelCorrection
|
||||
field = "MAP Averaging Logic @", mapAveragingSchedulingAtIndex
|
||||
|
|
|
@ -29,22 +29,43 @@ TEST(trigger, map_cam) {
|
|||
MapState state;
|
||||
|
||||
int i = 0;
|
||||
for (;i<404;i++) {
|
||||
for (;i<403;i++) {
|
||||
state.add(getZigZag(i));
|
||||
|
||||
if (state.mapBuffer.getCount() > engineConfiguration->mapCamAveragingLength) {
|
||||
ASSERT_FALSE(state.isPeak()) << "At " << i;
|
||||
ASSERT_FALSE(state.isPeak(false)) << "high At " << i;
|
||||
ASSERT_FALSE(state.isPeak(true)) << "low At " << i;
|
||||
}
|
||||
}
|
||||
|
||||
state.add(getZigZag(i));
|
||||
ASSERT_TRUE(state.isPeak()) << "At " << i;
|
||||
ASSERT_FALSE(state.isPeak(false)) << "high At " << i;
|
||||
ASSERT_FALSE(state.isPeak(true)) << "low At " << i;
|
||||
i++;
|
||||
|
||||
for (;i<604;i++) {
|
||||
|
||||
state.add(getZigZag(i));
|
||||
ASSERT_TRUE(state.isPeak(false)) << "high At " << i;
|
||||
ASSERT_FALSE(state.isPeak(true)) << "low At " << i;
|
||||
|
||||
for (;i<504;i++) {
|
||||
state.add(getZigZag(i));
|
||||
ASSERT_FALSE(state.isPeak()) << "At " << i;
|
||||
ASSERT_FALSE(state.isPeak(false)) << "high At " << i;
|
||||
ASSERT_FALSE(state.isPeak(true)) << "low At " << i;
|
||||
}
|
||||
|
||||
state.add(getZigZag(i));
|
||||
ASSERT_TRUE(state.isPeak()) << "At " << i;
|
||||
ASSERT_FALSE(state.isPeak(false)) << "high At " << i;
|
||||
ASSERT_TRUE(state.isPeak(true)) << "low At " << i;
|
||||
i++;
|
||||
|
||||
for (;i<604;i++) {
|
||||
state.add(getZigZag(i));
|
||||
ASSERT_FALSE(state.isPeak(false)) << "high At " << i;
|
||||
ASSERT_FALSE(state.isPeak(true)) << "low At " << i;
|
||||
}
|
||||
|
||||
state.add(getZigZag(i));
|
||||
ASSERT_TRUE(state.isPeak(false)) << "high At " << i;
|
||||
ASSERT_TRUE(state.isPeak(false)) << "low At " << i;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue