VVT miata trying to crank with random phase #1278
This commit is contained in:
parent
6bd5cd1112
commit
88bbbb6c33
|
@ -264,11 +264,18 @@ static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
|
efitick_t nowNt = getTimeNowNt();
|
||||||
|
|
||||||
|
if (nowNt - engine->triggerCentral.vvtSyncTimeNt >= NT_PER_SECOND) {
|
||||||
|
// loss of VVT sync
|
||||||
|
engine->triggerCentral.vvtSyncTimeNt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update engine RPM state if needed (check timeouts).
|
* Update engine RPM state if needed (check timeouts).
|
||||||
*/
|
*/
|
||||||
bool isSpinning = engine->rpmCalculator.checkIfSpinning(getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
|
bool isSpinning = engine->rpmCalculator.checkIfSpinning(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
if (!isSpinning) {
|
if (!isSpinning) {
|
||||||
engine->rpmCalculator.setStopSpinning(PASS_ENGINE_PARAMETER_SIGNATURE);
|
engine->rpmCalculator.setStopSpinning(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
@ -746,6 +753,6 @@ int getRusEfiVersion(void) {
|
||||||
if (initBootloader() != 0)
|
if (initBootloader() != 0)
|
||||||
return 123;
|
return 123;
|
||||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||||
return 20200422;
|
return 20200426;
|
||||||
}
|
}
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
|
@ -358,6 +358,14 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent
|
||||||
|
|
||||||
(void) ckpSignalType;
|
(void) ckpSignalType;
|
||||||
|
|
||||||
|
|
||||||
|
if (engineConfiguration->vvtMode == MIATA_NB2 && engine->triggerCentral.vvtSyncTimeNt == 0) {
|
||||||
|
// this is a bit spaghetti code for sure
|
||||||
|
// do not spark & do not fuel until we have VVT sync. NB2 is a special case
|
||||||
|
// due to symmetrical crank wheel and we need to make sure no spark happens out of sync
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasFirmwareError()) {
|
if (hasFirmwareError()) {
|
||||||
/**
|
/**
|
||||||
* In case on a major error we should not process any more events.
|
* In case on a major error we should not process any more events.
|
||||||
|
|
|
@ -135,6 +135,9 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
|
||||||
|
|
||||||
floatus_t oneDegreeUs = engine->rpmCalculator.oneDegreeUs;
|
floatus_t oneDegreeUs = engine->rpmCalculator.oneDegreeUs;
|
||||||
if (cisnan(oneDegreeUs)) {
|
if (cisnan(oneDegreeUs)) {
|
||||||
|
// todo: this code branch is slowing NB2 cranking since we require RPM sync for VVT sync!
|
||||||
|
// todo: smarter code
|
||||||
|
//
|
||||||
// we are here if we are getting VVT position signals while engine is not running
|
// we are here if we are getting VVT position signals while engine is not running
|
||||||
// for example if crank position sensor is broken :)
|
// for example if crank position sensor is broken :)
|
||||||
return;
|
return;
|
||||||
|
@ -166,6 +169,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tc->vvtSyncTimeNt = nowNt;
|
||||||
|
|
||||||
efitick_t offsetNt = nowNt - tc->timeAtVirtualZeroNt;
|
efitick_t offsetNt = nowNt - tc->timeAtVirtualZeroNt;
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
*/
|
*/
|
||||||
efitick_t timeAtVirtualZeroNt = 0;
|
efitick_t timeAtVirtualZeroNt = 0;
|
||||||
|
|
||||||
|
efitick_t vvtSyncTimeNt = 0;
|
||||||
|
|
||||||
TriggerWaveform triggerShape;
|
TriggerWaveform triggerShape;
|
||||||
|
|
||||||
efitick_t previousVvtCamTime = DEEP_IN_THE_PAST_SECONDS * NT_PER_SECOND;
|
efitick_t previousVvtCamTime = DEEP_IN_THE_PAST_SECONDS * NT_PER_SECOND;
|
||||||
|
|
Loading…
Reference in New Issue