parent
ce32c26fa2
commit
0c91e77749
|
@ -260,7 +260,7 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 0, 0
|
||||||
uint8_t fallbackMap;;"", 1, 0, -10000, 10000, 3
|
uint8_t fallbackMap;;"", 1, 0, -10000, 10000, 3
|
||||||
uint8_t TEMPLOG_map_peak;;"", 1, 0, -10000, 10000, 3
|
uint8_t TEMPLOG_map_peak;;"", 1, 0, -10000, 10000, 3
|
||||||
uint8_t TEMPLOG_map_length;;"", 1, 0, -10000, 10000, 3
|
uint8_t TEMPLOG_map_length;;"", 1, 0, -10000, 10000, 3
|
||||||
uint8_t unused113;;"", 1, 0, -10000, 10000, 3
|
uint8_t TEMPLOG_mapIndex;;"", 1, 0, -10000, 10000, 3
|
||||||
|
|
||||||
|
|
||||||
uint16_t autoscale timingCltCorrection;;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0
|
uint16_t autoscale timingCltCorrection;;"%",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0
|
||||||
|
|
|
@ -92,6 +92,8 @@ static void startAveraging(scheduling_s *endAveragingScheduling) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAL_USE_ADC
|
#if HAL_USE_ADC
|
||||||
|
static int fastMapCounter = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is invoked from ADC callback.
|
* This method is invoked from ADC callback.
|
||||||
* @note This method is invoked OFTEN, this method is a potential bottleneck - the implementation should be
|
* @note This method is invoked OFTEN, this method is a potential bottleneck - the implementation should be
|
||||||
|
@ -106,7 +108,8 @@ void mapAveragingAdcCallback(adcsample_t adcValue) {
|
||||||
tsOutputChannels.instantMAPValue = instantMap;
|
tsOutputChannels.instantMAPValue = instantMap;
|
||||||
#endif // EFI_TUNER_STUDIO
|
#endif // EFI_TUNER_STUDIO
|
||||||
|
|
||||||
if (engineConfiguration->vvtMode[0] == VVT_MAP_V_TWIN) {
|
if (engineConfiguration->vvtMode[0] == VVT_MAP_V_TWIN &&
|
||||||
|
((fastMapCounter++ % engineConfiguration->mapCamSkipFactor) == 0)) {
|
||||||
engine->triggerCentral.mapState.add(instantMap);
|
engine->triggerCentral.mapState.add(instantMap);
|
||||||
bool isPeak = engine->triggerCentral.mapState.isPeak();
|
bool isPeak = engine->triggerCentral.mapState.isPeak();
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#include "local_version_holder.h"
|
#include "local_version_holder.h"
|
||||||
|
|
||||||
#define MAP_CAM_BUFFER 64
|
#define MAP_CAM_BUFFER 8
|
||||||
|
|
||||||
class Engine;
|
class Engine;
|
||||||
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index, efitick_t edgeTimestamp);
|
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index, efitick_t edgeTimestamp);
|
||||||
|
@ -45,7 +45,7 @@ struct MapState {
|
||||||
|
|
||||||
// add new value
|
// add new value
|
||||||
mapBuffer.add(value);
|
mapBuffer.add(value);
|
||||||
current = mapBuffer.sum(MAP_CAM_BUFFER);
|
current = mapBuffer.sum(engineConfiguration->mapCamAveragingLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPeak() {
|
bool isPeak() {
|
||||||
|
|
|
@ -23,14 +23,16 @@ static int getZigZag(int index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(trigger, map_cam) {
|
TEST(trigger, map_cam) {
|
||||||
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
|
engineConfiguration->mapCamAveragingLength = 8;
|
||||||
MapState state;
|
MapState state;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (;i<404;i++) {
|
for (;i<404;i++) {
|
||||||
state.add(getZigZag(i));
|
state.add(getZigZag(i));
|
||||||
|
|
||||||
if (state.mapBuffer.getCount() > MAP_CAM_BUFFER) {
|
if (state.mapBuffer.getCount() > engineConfiguration->mapCamAveragingLength) {
|
||||||
ASSERT_FALSE(state.isPeak()) << "At " << i;
|
ASSERT_FALSE(state.isPeak()) << "At " << i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue