log current engine phase on trigger teeth (#3471)

* log phase on trigger teeth

* ui

* guard
This commit is contained in:
Matthew Kennedy 2021-11-05 17:02:15 -07:00 committed by GitHub
parent 2a169f7d8c
commit 7590e4c679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 1 deletions

View File

@ -135,7 +135,7 @@ struct TunerStudioOutputChannels {
scaled_percent iatCorrection; // 64
scaled_percent cltCorrection; // 66
scaled_percent baroCorrection; // 68
uint16_t unused70; // 70
uint16_t currentEnginePhase; // 70
// Wall model AE
scaled_ms wallFuelAmount; // 72

View File

@ -884,6 +884,14 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
}
}
void updateCurrentEnginePhase(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (auto phase = engine->triggerCentral.getCurrentEnginePhase(getTimeNowNt())) {
tsOutputChannels.currentEnginePhase = phase.Value - tdcPosition();
} else {
tsOutputChannels.currentEnginePhase = 0;
}
}
void prepareTunerStudioOutputs(void) {
// sensor state for EFI Analytics Tuner Studio
updateTunerStudioState(&tsOutputChannels PASS_ENGINE_PARAMETER_SUFFIX);

View File

@ -11,6 +11,7 @@
void updateDevConsoleState(void);
void prepareTunerStudioOutputs(void);
void updateCurrentEnginePhase(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void startStatusThreads(void);
void initStatusLoop(void);

View File

@ -24,6 +24,7 @@
#include "tooth_logger.h"
#include "map_averaging.h"
#include "main_trigger_callback.h"
#include "status_loop.h"
#if EFI_TUNER_STUDIO
#include "tunerstudio.h"
@ -658,6 +659,10 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
#endif
mainTriggerCallback(triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
#if EFI_TUNER_STUDIO
updateCurrentEnginePhase(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif
}
}

View File

@ -426,6 +426,8 @@ enable2ndByteCanID = false
rawTps1Secondary = scalar, U16, 300, "V",{1/@@PACK_MULT_VOLTAGE@@}, 0.0
rawTps2Primary = scalar, U16, 302, "V",{1/@@PACK_MULT_VOLTAGE@@}, 0.0
rawTps2Secondary = scalar, U16, 304, "V",{1/@@PACK_MULT_VOLTAGE@@}, 0.0
currentEnginePhase = scalar, U16, 70, "deg", 1, 0
;
; see TunerStudioOutputChannels struct
;
@ -1031,6 +1033,7 @@ gaugeCategory = Sensors - Extra 2
speedToRpmRatioGauge = speedToRpmRatio, "speed2rpm", "", 0, 100, 0, 0, 100, 100, 4, 4
wastegatePosGauge = wastegatePositionSensor, @@GAUGE_NAME_WG_POSITION@@, "%", 0, 100, 0, 0, 100, 100, 1, 1
idlePosSensGauge = idlePositionSensor, @@GAUGE_NAME_IDLE_POSITION@@, "%", 0, 100, 0, 0, 100, 100, 1, 1
currentEnginePhaseGauge = currentEnginePhase, "Engine Phase", "deg", 0, 720, 0, 0, 720, 720, 0, 0
gaugeCategory = ECU Status
warningCounterGauge = warningCounter, @@GAUGE_NAME_WARNING_COUNT@@, "", 0, 100, 0, 0, 100, 100, 0, 0
@ -1439,6 +1442,7 @@ gaugeCategory = DynoView
entry = VssAcceleration, "Vss Accel", float, "%.3f"
entry = flexPercent, @@GAUGE_NAME_FLEX@@, int, "%d"
entry = currentEnginePhase, "Engine Phase", int, "%d"
[Menu]