MAP phase sensing #3544
This commit is contained in:
parent
228d5ee810
commit
48ed80ffb9
|
@ -205,8 +205,8 @@ static void doPeriodicSlowCallback() {
|
||||||
for (int camIndex = 0; camIndex < CAMS_PER_BANK; camIndex++) {
|
for (int camIndex = 0; camIndex < CAMS_PER_BANK; camIndex++) {
|
||||||
if (nowNt - engine->triggerCentral.vvtSyncTimeNt[bankIndex][camIndex] >= NT_PER_SECOND) {
|
if (nowNt - engine->triggerCentral.vvtSyncTimeNt[bankIndex][camIndex] >= NT_PER_SECOND) {
|
||||||
// loss of VVT sync
|
// loss of VVT sync
|
||||||
|
// todo: this code would get simpler if we convert vvtSyncTimeNt to Timer
|
||||||
engine->triggerCentral.vvtSyncTimeNt[bankIndex][camIndex] = 0;
|
engine->triggerCentral.vvtSyncTimeNt[bankIndex][camIndex] = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,6 +330,10 @@ static void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm,
|
||||||
uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT;
|
uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bool noFiringUntilVvtSync(vvt_mode_e mode) {
|
||||||
|
return mode == VVT_MIATA_NB2 || mode == VVT_MAP_V_TWIN;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main trigger event handler.
|
* This is the main trigger event handler.
|
||||||
* Both injection and ignition are controlled from this method.
|
* Both injection and ignition are controlled from this method.
|
||||||
|
@ -337,10 +341,11 @@ uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT;
|
||||||
void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp) {
|
void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp) {
|
||||||
ScopePerf perf(PE::MainTriggerCallback);
|
ScopePerf perf(PE::MainTriggerCallback);
|
||||||
|
|
||||||
if (engineConfiguration->vvtMode[0] == VVT_MIATA_NB2 && engine->triggerCentral.vvtSyncTimeNt == 0) {
|
if (noFiringUntilVvtSync(engineConfiguration->vvtMode[0]) && engine->triggerCentral.vvtSyncTimeNt == 0) {
|
||||||
// this is a bit spaghetti code for sure
|
// this is a bit spaghetti code for sure
|
||||||
// do not spark & do not fuel until we have VVT sync. NB2 is a special case
|
// do not spark & do not fuel until we have VVT sync.
|
||||||
// due to symmetrical crank wheel and we need to make sure no spark happens out of sync
|
// NB2 is a special case due to symmetrical crank wheel and we need to make sure no spark happens out of sync
|
||||||
|
// VTwin is another special case where we really need to know phase before firing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,19 @@
|
||||||
#include "trigger_misc.h"
|
#include "trigger_misc.h"
|
||||||
#include "trigger_universal.h"
|
#include "trigger_universal.h"
|
||||||
|
|
||||||
|
void configureVvt45VTwin(TriggerWaveform *s) {
|
||||||
|
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
||||||
|
|
||||||
|
s->setTriggerSynchronizationGap(0.78);
|
||||||
|
s->setSecondTriggerSynchronizationGap(1.29);
|
||||||
|
|
||||||
|
s->addEvent720(315 - 1, T_PRIMARY, TV_RISE);
|
||||||
|
s->addEvent720(315, T_PRIMARY, TV_FALL);
|
||||||
|
|
||||||
|
s->addEvent720(720 - 1, T_PRIMARY, TV_RISE);
|
||||||
|
s->addEvent720(720, T_PRIMARY, TV_FALL);
|
||||||
|
}
|
||||||
|
|
||||||
// TT_FIAT_IAW_P8
|
// TT_FIAT_IAW_P8
|
||||||
void configureFiatIAQ_P8(TriggerWaveform * s) {
|
void configureFiatIAQ_P8(TriggerWaveform * s) {
|
||||||
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
||||||
|
|
|
@ -16,4 +16,5 @@ void configureFordST170(TriggerWaveform * s);
|
||||||
void configureTriTach(TriggerWaveform * s);
|
void configureTriTach(TriggerWaveform * s);
|
||||||
// TT_VVT_BARRA_3_PLUS_1
|
// TT_VVT_BARRA_3_PLUS_1
|
||||||
void configureBarra3plus1cam(TriggerWaveform *s);
|
void configureBarra3plus1cam(TriggerWaveform *s);
|
||||||
|
void configureVvt45VTwin(TriggerWaveform *s);
|
||||||
|
|
||||||
|
|
|
@ -527,6 +527,9 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TT_VVT_MAP_45_V_TWIN:
|
case TT_VVT_MAP_45_V_TWIN:
|
||||||
|
configureVvt45VTwin(this);
|
||||||
|
break;
|
||||||
|
|
||||||
case TT_NISSAN_QR25:
|
case TT_NISSAN_QR25:
|
||||||
initializeNissanQR25crank(this);
|
initializeNissanQR25crank(this);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -110,6 +110,7 @@ public:
|
||||||
// synchronization event position
|
// synchronization event position
|
||||||
angle_t vvtPosition[BANKS_COUNT][CAMS_PER_BANK];
|
angle_t vvtPosition[BANKS_COUNT][CAMS_PER_BANK];
|
||||||
|
|
||||||
|
// todo: convert to Timer!
|
||||||
efitick_t vvtSyncTimeNt[BANKS_COUNT][CAMS_PER_BANK];
|
efitick_t vvtSyncTimeNt[BANKS_COUNT][CAMS_PER_BANK];
|
||||||
|
|
||||||
TriggerStateWithRunningStatistics triggerState;
|
TriggerStateWithRunningStatistics triggerState;
|
||||||
|
|
Loading…
Reference in New Issue