log tooth angle difference (#4613)
This commit is contained in:
parent
7139ddcda2
commit
dd41cf0a05
|
@ -704,7 +704,15 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
||||||
// todo: what is broken _exactly_?
|
// todo: what is broken _exactly_?
|
||||||
currentEngineDecodedPhase = currentPhase;
|
currentEngineDecodedPhase = currentPhase;
|
||||||
|
|
||||||
// Record precise time and phase of the engine. This is used for VVT decode.
|
// Check that the expected next phase (from the last tooth) is close to the actual current phase:
|
||||||
|
// basically, check that the tooth width is correct
|
||||||
|
auto estimatedCurrentPhase = getCurrentEnginePhase(timestamp);
|
||||||
|
if (estimatedCurrentPhase) {
|
||||||
|
triggerToothAngleError = expectedNextPhase - estimatedCurrentPhase.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Record precise time and phase of the engine. This is used for VVT decode, and to check that the
|
||||||
|
// trigger pattern selected matches reality (ie, we check the next tooth is where we think it should be)
|
||||||
{
|
{
|
||||||
// under lock to avoid mismatched tooth phase and time
|
// under lock to avoid mismatched tooth phase and time
|
||||||
chibios_rt::CriticalSectionLocker csl;
|
chibios_rt::CriticalSectionLocker csl;
|
||||||
|
@ -744,6 +752,8 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
||||||
wrapAngle(nextPhase, "nextEnginePhase", CUSTOM_ERR_6555);
|
wrapAngle(nextPhase, "nextEnginePhase", CUSTOM_ERR_6555);
|
||||||
} while (nextPhase == currentPhase);
|
} while (nextPhase == currentPhase);
|
||||||
|
|
||||||
|
expectedNextPhase = nextPhase + tdcPosition();
|
||||||
|
wrapAngle(expectedNextPhase, "nextEnginePhase", CUSTOM_ERR_6555);
|
||||||
|
|
||||||
#if EFI_CDM_INTEGRATION
|
#if EFI_CDM_INTEGRATION
|
||||||
if (trgEventIndex == 0 && isBrainPinValid(engineConfiguration->cdmInputPin)) {
|
if (trgEventIndex == 0 && isBrainPinValid(engineConfiguration->cdmInputPin)) {
|
||||||
|
|
|
@ -188,6 +188,10 @@ private:
|
||||||
Timer m_lastToothTimer;
|
Timer m_lastToothTimer;
|
||||||
// Phase of the last tooth relative to the sync point
|
// Phase of the last tooth relative to the sync point
|
||||||
float m_lastToothPhaseFromSyncPoint;
|
float m_lastToothPhaseFromSyncPoint;
|
||||||
|
|
||||||
|
// At what engine phase do we expect the next tooth to arrive?
|
||||||
|
// Used for checking whether your trigger pattern is correct.
|
||||||
|
float expectedNextPhase;
|
||||||
};
|
};
|
||||||
|
|
||||||
void triggerInfo(void);
|
void triggerInfo(void);
|
||||||
|
|
|
@ -13,5 +13,7 @@ int vvtCamCounter
|
||||||
|
|
||||||
float autoscale currentEngineDecodedPhase;Engine Phase;"deg",1, 0, 0, 0, 0
|
float autoscale currentEngineDecodedPhase;Engine Phase;"deg",1, 0, 0, 0, 0
|
||||||
|
|
||||||
|
float triggerToothAngleError;;"deg", 1, 0, -30, 30, 2
|
||||||
|
|
||||||
end_struct
|
end_struct
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue