multi-channel Tuner Studio tooth logger #1284

This commit is contained in:
rusefi 2020-04-15 19:10:54 -04:00
parent a1788c1545
commit 5c4eb10c52
2 changed files with 29 additions and 4 deletions

View File

@ -24,7 +24,7 @@
#include "trigger_simulator.h"
#include "rpm_calculator.h"
#include "tooth_logger.h"
#include "perf_trace.h"
#if EFI_PROD_CODE
@ -103,13 +103,33 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
tc->vvtEventFallCounter++;
}
if (!CONFIG(displayLogicLevelsInEngineSniffer)) {
addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
}
addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
if (CONFIG(vvtCamSensorUseRise) ^ (front != TV_FALL)) {
return;
}
if (CONFIG(displayLogicLevelsInEngineSniffer)) {
if (CONFIG(vvtCamSensorUseRise)) {
// todo: unify TS composite logger code with console Engine Sniffer
// todo: better API to reduce copy/paste?
LogTriggerTooth(SHAFT_SECONDARY_RISING, nowNt);
LogTriggerTooth(SHAFT_SECONDARY_FALLING, nowNt);
addEngineSnifferEvent(PROTOCOL_VVT_NAME, PROTOCOL_ES_UP);
addEngineSnifferEvent(PROTOCOL_VVT_NAME, PROTOCOL_ES_DOWN);
} else {
LogTriggerTooth(SHAFT_SECONDARY_FALLING, nowNt);
LogTriggerTooth(SHAFT_SECONDARY_RISING, nowNt);
addEngineSnifferEvent(PROTOCOL_VVT_NAME, PROTOCOL_ES_DOWN);
addEngineSnifferEvent(PROTOCOL_VVT_NAME, PROTOCOL_ES_UP);
}
}
floatus_t oneDegreeUs = engine->rpmCalculator.oneDegreeUs;
if (cisnan(oneDegreeUs)) {
// we are here if we are getting VVT position signals while engine is not running

View File

@ -30,7 +30,10 @@ static Logging *logger;
static void vvtRisingCallback(void *) {
efitick_t now = getTimeNowNt();
#if EFI_TOOTH_LOGGER
LogTriggerTooth(SHAFT_SECONDARY_RISING, now);
if (!CONFIG(displayLogicLevelsInEngineSniffer)) {
// real physical fronts go into engine sniffer
LogTriggerTooth(SHAFT_SECONDARY_RISING, now);
}
#endif /* EFI_TOOTH_LOGGER */
hwHandleVvtCamSignal(TV_RISE, now);
}
@ -38,7 +41,9 @@ static void vvtRisingCallback(void *) {
static void vvtFallingCallback(void *) {
efitick_t now = getTimeNowNt();
#if EFI_TOOTH_LOGGER
LogTriggerTooth(SHAFT_SECONDARY_FALLING, now);
if (!CONFIG(displayLogicLevelsInEngineSniffer)) {
LogTriggerTooth(SHAFT_SECONDARY_FALLING, now);
}
#endif /* EFI_TOOTH_LOGGER */
hwHandleVvtCamSignal(TV_FALL, now);
}