verbose trigger sync should reuse engineSnifferRpmThreshold #4259

reducing complexity
This commit is contained in:
rusefi 2022-06-18 14:17:36 -04:00
parent e8e0e7bd6d
commit 514531bc5c
7 changed files with 21 additions and 13 deletions

View File

@ -274,7 +274,7 @@ void Engine::updateSlowSensors() {
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
int rpm = Sensor::getOrZero(SensorType::Rpm); int rpm = Sensor::getOrZero(SensorType::Rpm);
isEngineChartEnabled = engineConfiguration->isEngineChartEnabled && rpm < engineConfiguration->engineSnifferRpmThreshold; isEngineSnifferEnabled = rpm < engineConfiguration->engineSnifferRpmThreshold;
sensorChartMode = rpm < engineConfiguration->sensorSnifferRpmThreshold ? engineConfiguration->sensorChartMode : SC_OFF; sensorChartMode = rpm < engineConfiguration->sensorSnifferRpmThreshold ? engineConfiguration->sensorChartMode : SC_OFF;
engineState.updateSlowSensors(); engineState.updateSlowSensors();

View File

@ -280,7 +280,7 @@ public:
#endif #endif
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
TestExecutor executor; TestExecutor executor;
#endif #endif // EFI_UNIT_TEST
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
FuelSchedule injectionEvents; FuelSchedule injectionEvents;
@ -290,11 +290,13 @@ public:
bool etbAutoTune = false; bool etbAutoTune = false;
/** /**
* this is based on isEngineChartEnabled and engineSnifferRpmThreshold settings * this is based on engineSnifferRpmThreshold settings and current RPM
*/ */
bool isEngineChartEnabled = false; bool isEngineSnifferEnabled = false;
bool tdcMarkEnabled = true; // used by unit tests only #if EFI_UNIT_TEST
bool tdcMarkEnabled = true;
#endif // EFI_UNIT_TEST
/** /**
* this is based on sensorChartMode and sensorSnifferRpmThreshold settings * this is based on sensorChartMode and sensorSnifferRpmThreshold settings

View File

@ -656,8 +656,6 @@ static void setDefaultEngineConfiguration() {
engineConfiguration->baroSensor.lowValue = 0; engineConfiguration->baroSensor.lowValue = 0;
engineConfiguration->baroSensor.highValue = 500; engineConfiguration->baroSensor.highValue = 500;
engineConfiguration->isEngineChartEnabled = true;
#if EFI_PROD_CODE #if EFI_PROD_CODE
engineConfiguration->engineChartSize = 300; engineConfiguration->engineChartSize = 300;
#else #else

View File

@ -332,7 +332,15 @@ static void onTdcCallback(void *) {
void tdcMarkCallback( void tdcMarkCallback(
uint32_t index0, efitick_t edgeTimestamp) { uint32_t index0, efitick_t edgeTimestamp) {
bool isTriggerSynchronizationPoint = index0 == 0; bool isTriggerSynchronizationPoint = index0 == 0;
if (isTriggerSynchronizationPoint && engine->isEngineChartEnabled && engine->tdcMarkEnabled) { if (isTriggerSynchronizationPoint && engine->isEngineSnifferEnabled) {
#if EFI_UNIT_TEST
if (!engine->tdcMarkEnabled) {
return;
}
#endif // EFI_UNIT_TEST
// two instances of scheduling_s are needed to properly handle event overlap // two instances of scheduling_s are needed to properly handle event overlap
int revIndex2 = getRevolutionCounter() % 2; int revIndex2 = getRevolutionCounter() % 2;
int rpm = Sensor::getOrZero(SensorType::Rpm); int rpm = Sensor::getOrZero(SensorType::Rpm);

View File

@ -174,7 +174,7 @@ void initRpmCalculator();
#define getRevolutionCounter() (engine->rpmCalculator.getRevolutionCounterM()) #define getRevolutionCounter() (engine->rpmCalculator.getRevolutionCounterM())
#if EFI_ENGINE_SNIFFER #if EFI_ENGINE_SNIFFER
#define addEngineSnifferEvent(name, msg) { if (engine->isEngineChartEnabled) { waveChart.addEvent3((name), (msg)); } } #define addEngineSnifferEvent(name, msg) { if (engine->isEngineSnifferEnabled) { waveChart.addEvent3((name), (msg)); } }
#else #else
#define addEngineSnifferEvent(n, msg) {} #define addEngineSnifferEvent(n, msg) {}
#endif /* EFI_ENGINE_SNIFFER */ #endif /* EFI_ENGINE_SNIFFER */

View File

@ -510,7 +510,7 @@ static const bool isUpEvent[6] = { false, true, false, true, false, true };
static const char *eventId[6] = { PROTOCOL_CRANK1, PROTOCOL_CRANK1, PROTOCOL_CRANK2, PROTOCOL_CRANK2, PROTOCOL_CRANK3, PROTOCOL_CRANK3 }; static const char *eventId[6] = { PROTOCOL_CRANK1, PROTOCOL_CRANK1, PROTOCOL_CRANK2, PROTOCOL_CRANK2, PROTOCOL_CRANK3, PROTOCOL_CRANK3 };
static void reportEventToWaveChart(trigger_event_e ckpSignalType, int index) { static void reportEventToWaveChart(trigger_event_e ckpSignalType, int index) {
if (!engine->isEngineChartEnabled) { // this is here just as a shortcut so that we avoid engine sniffer as soon as possible if (!engine->isEngineSnifferEnabled) { // this is here just as a shortcut so that we avoid engine sniffer as soon as possible
return; // engineSnifferRpmThreshold is accounted for inside engine->isEngineChartEnabled return; // engineSnifferRpmThreshold is accounted for inside engine->isEngineChartEnabled
} }

View File

@ -145,7 +145,7 @@ void WaveChart::publish() {
Logging *l = &chart->logging; Logging *l = &chart->logging;
efiPrintf("IT'S TIME", strlen(l->buffer)); efiPrintf("IT'S TIME", strlen(l->buffer));
#endif #endif
if (engine->isEngineChartEnabled) { if (engine->isEngineSnifferEnabled) {
scheduleLogging(&logging); scheduleLogging(&logging);
} }
} }
@ -154,14 +154,14 @@ void WaveChart::publish() {
* @brief Register an event for digital sniffer * @brief Register an event for digital sniffer
*/ */
void WaveChart::addEvent3(const char *name, const char * msg) { void WaveChart::addEvent3(const char *name, const char * msg) {
#if EFI_TEXT_LOGGING
ScopePerf perf(PE::EngineSniffer); ScopePerf perf(PE::EngineSniffer);
efitick_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
if (nowNt < pauseEngineSnifferUntilNt) { if (nowNt < pauseEngineSnifferUntilNt) {
return; return;
} }
#if EFI_TEXT_LOGGING if (!engine->isEngineSnifferEnabled) {
if (!engine->isEngineChartEnabled) {
return; return;
} }
if (skipUntilEngineCycle != 0 && getRevolutionCounter() < skipUntilEngineCycle) if (skipUntilEngineCycle != 0 && getRevolutionCounter() < skipUntilEngineCycle)