deep rabbit holes are the best ones!
refactoring: encapsulation
This commit is contained in:
parent
12d857b99c
commit
2c0ce0ec7d
|
@ -242,7 +242,7 @@ void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't log at significant engine speed
|
// Don't log at significant engine speed
|
||||||
if (!engine->isEngineSnifferEnabled) {
|
if (!getTriggerCentral()->isEngineSnifferEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ void Engine::updateSlowSensors() {
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL
|
#if EFI_ENGINE_CONTROL
|
||||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||||
isEngineSnifferEnabled = rpm < engineConfiguration->engineSnifferRpmThreshold;
|
triggerCentral.isEngineSnifferEnabled = rpm < engineConfiguration->engineSnifferRpmThreshold;
|
||||||
sensorChartMode = rpm < engineConfiguration->sensorSnifferRpmThreshold ? engineConfiguration->sensorChartMode : SC_OFF;
|
sensorChartMode = rpm < engineConfiguration->sensorSnifferRpmThreshold ? engineConfiguration->sensorChartMode : SC_OFF;
|
||||||
|
|
||||||
engineState.updateSlowSensors();
|
engineState.updateSlowSensors();
|
||||||
|
@ -609,3 +609,7 @@ ExecutorInterface *getExecutorInterface() {
|
||||||
TriggerCentral * getTriggerCentral() {
|
TriggerCentral * getTriggerCentral() {
|
||||||
return &engine->triggerCentral;
|
return &engine->triggerCentral;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LimpManager * getLimpManager() {
|
||||||
|
return &engine->limpManager;
|
||||||
|
}
|
||||||
|
|
|
@ -220,10 +220,6 @@ public:
|
||||||
|
|
||||||
// todo: move to electronic_throttle something?
|
// todo: move to electronic_throttle something?
|
||||||
bool etbAutoTune = false;
|
bool etbAutoTune = false;
|
||||||
/**
|
|
||||||
* this is based on engineSnifferRpmThreshold settings and current RPM
|
|
||||||
*/
|
|
||||||
bool isEngineSnifferEnabled = false;
|
|
||||||
|
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
bool tdcMarkEnabled = true;
|
bool tdcMarkEnabled = true;
|
||||||
|
|
|
@ -365,7 +365,7 @@ static void onTdcCallback(void *) {
|
||||||
void tdcMarkCallback(
|
void tdcMarkCallback(
|
||||||
uint32_t trgEventIndex, efitick_t edgeTimestamp) {
|
uint32_t trgEventIndex, efitick_t edgeTimestamp) {
|
||||||
bool isTriggerSynchronizationPoint = trgEventIndex == 0;
|
bool isTriggerSynchronizationPoint = trgEventIndex == 0;
|
||||||
if (isTriggerSynchronizationPoint && engine->isEngineSnifferEnabled) {
|
if (isTriggerSynchronizationPoint && getTriggerCentral()->isEngineSnifferEnabled) {
|
||||||
|
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
if (!engine->tdcMarkEnabled) {
|
if (!engine->tdcMarkEnabled) {
|
||||||
|
|
|
@ -183,7 +183,7 @@ operation_mode_e lookupOperationMode();
|
||||||
#define getRevolutionCounter() (engine->rpmCalculator.getRevolutionCounterM())
|
#define getRevolutionCounter() (engine->rpmCalculator.getRevolutionCounterM())
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER
|
#if EFI_ENGINE_SNIFFER
|
||||||
#define addEngineSnifferEvent(name, msg) { if (engine->isEngineSnifferEnabled) { waveChart.addEvent3((name), (msg)); } }
|
#define addEngineSnifferEvent(name, msg) { if (getTriggerCentral()->isEngineSnifferEnabled) { waveChart.addEvent3((name), (msg)); } }
|
||||||
#else
|
#else
|
||||||
#define addEngineSnifferEvent(n, msg) {}
|
#define addEngineSnifferEvent(n, msg) {}
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
|
|
@ -115,3 +115,7 @@ private:
|
||||||
|
|
||||||
Timer m_engineStopTimer;
|
Timer m_engineStopTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LimpManager * getLimpManager();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,7 @@ void handleShaftSignal(int signalIndex, bool isRising, efitick_t timestamp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't accept trigger input in case of some problems
|
// Don't accept trigger input in case of some problems
|
||||||
if (!engine->limpManager.allowTriggerInput()) {
|
if (!getLimpManager()->allowTriggerInput()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,8 +520,8 @@ static const bool isUpEvent[4] = { false, true, false, true };
|
||||||
static const int wheelIndeces[4] = { 0, 0, 1, 1};
|
static const int wheelIndeces[4] = { 0, 0, 1, 1};
|
||||||
|
|
||||||
static void reportEventToWaveChart(trigger_event_e ckpSignalType, int triggerEventIndex) {
|
static void reportEventToWaveChart(trigger_event_e ckpSignalType, int triggerEventIndex) {
|
||||||
if (!engine->isEngineSnifferEnabled) { // this is here just as a shortcut so that we avoid engine sniffer as soon as possible
|
if (!getTriggerCentral()->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->isEngineSnifferEnabled
|
return; // engineSnifferRpmThreshold is accounted for inside getTriggerCentral()->isEngineSnifferEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
int wheelIndex = wheelIndeces[(int )ckpSignalType];
|
int wheelIndex = wheelIndeces[(int )ckpSignalType];
|
||||||
|
@ -631,7 +631,7 @@ void TriggerCentral::decodeMapCam(efitick_t timestamp, float currentPhase) {
|
||||||
// but current implementation which is based on periodicFastCallback would only make result available on NEXT tooth
|
// but current implementation which is based on periodicFastCallback would only make result available on NEXT tooth
|
||||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||||
efitick_t nowNt = getTimeNowNt();
|
efitick_t nowNt = getTimeNowNt();
|
||||||
engine->limpManager.updateState(rpm, nowNt);
|
getLimpManager()->updateState(rpm, nowNt);
|
||||||
#endif // EFI_UNIT_TEST
|
#endif // EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,11 @@ public:
|
||||||
// Keep track of the last time we got a valid trigger event
|
// Keep track of the last time we got a valid trigger event
|
||||||
Timer m_lastEventTimer;
|
Timer m_lastEventTimer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this is based on engineSnifferRpmThreshold settings and current RPM
|
||||||
|
*/
|
||||||
|
bool isEngineSnifferEnabled = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void decodeMapCam(efitick_t nowNt, float currentPhase);
|
void decodeMapCam(efitick_t nowNt, float currentPhase);
|
||||||
|
|
||||||
|
|
|
@ -611,7 +611,7 @@ expected<TriggerDecodeResult> TriggerDecoderBase::decodeTriggerEvent(
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
bool verbose = engine->isEngineSnifferEnabled && triggerConfiguration.VerboseTriggerSynchDetails;
|
bool verbose = getTriggerCentral()->isEngineSnifferEnabled && triggerConfiguration.VerboseTriggerSynchDetails;
|
||||||
|
|
||||||
if (verbose || (someSortOfTriggerError() && !silentTriggerError)) {
|
if (verbose || (someSortOfTriggerError() && !silentTriggerError)) {
|
||||||
const char * prefix = verbose ? "[vrb]" : "[err]";
|
const char * prefix = verbose ? "[vrb]" : "[err]";
|
||||||
|
|
|
@ -114,7 +114,7 @@ int WaveChart::getSize() {
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
static void printStatus() {
|
static void printStatus() {
|
||||||
efiPrintf("engine sniffer: %s", boolToString(engine->isEngineSnifferEnabled));
|
efiPrintf("engine sniffer: %s", boolToString(getTriggerCentral()->isEngineSnifferEnabled));
|
||||||
efiPrintf("engine sniffer size=%d", engineConfiguration->engineChartSize);
|
efiPrintf("engine sniffer size=%d", engineConfiguration->engineChartSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,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->isEngineSnifferEnabled) {
|
if (getTriggerCentral()->isEngineSnifferEnabled) {
|
||||||
scheduleLogging(&logging);
|
scheduleLogging(&logging);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ void WaveChart::addEvent3(const char *name, const char * msg) {
|
||||||
if (nowNt < pauseEngineSnifferUntilNt) {
|
if (nowNt < pauseEngineSnifferUntilNt) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!engine->isEngineSnifferEnabled) {
|
if (!getTriggerCentral()->isEngineSnifferEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (skipUntilEngineCycle != 0 && getRevolutionCounter() < skipUntilEngineCycle)
|
if (skipUntilEngineCycle != 0 && getRevolutionCounter() < skipUntilEngineCycle)
|
||||||
|
|
Loading…
Reference in New Issue