3A92 not syncing (not happy Mitsubicha but another vehicle) #5401

This commit is contained in:
Andrey 2023-07-13 20:01:49 -04:00
parent 8e76a82a26
commit f4b69659b9
6 changed files with 38 additions and 11 deletions

View File

@ -59,17 +59,13 @@ void initializeMitsubishi4g63Cam(TriggerWaveform *s) {
initializeMitsubishi4g9xCam(s);
}
void initialize36_2_1_1(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);
s->tdcPosition = 90;
int totalTeethCount = 36;
float engineCycle = FOUR_STROKE_ENGINE_CYCLE;
static void add36_2_1_1(TriggerWaveform *s, float engineCycle, float off) {
float toothWidth = 0.5;
float oneTooth = 720 / totalTeethCount;
int totalTeethCount = 36;
float oneTooth = engineCycle / totalTeethCount;
float offset = (36 - 11 - 12 - 11) * oneTooth;
float offset = off + (36 - 11 - 12 - 11) * oneTooth;
addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
NO_LEFT_FILTER, offset + 11 * oneTooth + 1);
@ -84,6 +80,24 @@ void initialize36_2_1_1(TriggerWaveform *s) {
addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
NO_LEFT_FILTER, offset + 10 * oneTooth + 1);
}
void initialize36_2_1_1(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);
s->tdcPosition = 90;
add36_2_1_1(s, FOUR_STROKE_ENGINE_CYCLE, 0);
s->setTriggerSynchronizationGap(3);
s->setSecondTriggerSynchronizationGap(1); // redundancy
}
void initialize36_2_1_1_3cyl(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly);
s->tdcPosition = 90;
s->isMitsubicha = true;
add36_2_1_1(s, 360, 0);
add36_2_1_1(s, 360, 360);
s->setTriggerSynchronizationGap(3);
s->setSecondTriggerSynchronizationGap(1); // redundancy

View File

@ -17,6 +17,7 @@ void initializeMitsubishi4g9xCam(TriggerWaveform *s);
void configureFordAspireTriggerWaveform(TriggerWaveform * s);
void initialize36_2_1_1(TriggerWaveform *s);
void initialize36_2_1_1_3cyl(TriggerWaveform *s);
void initialize36_2_1(TriggerWaveform *s);
void initializeVvt3A92(TriggerWaveform *s);

View File

@ -51,6 +51,7 @@ void TriggerWaveform::initialize(operation_mode_e operationMode, SyncEdge syncEd
isSecondWheelCam = false;
needSecondTriggerInput = false;
shapeWithoutTdc = false;
isMitsubicha = false;
// If RiseOnly, ignore falling edges completely.
useOnlyRisingEdges = syncEdge == SyncEdge::RiseOnly;
@ -648,11 +649,14 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e triggerOperatio
break;
case trigger_type_e::TT_UNUSED_11:
case trigger_type_e::TT_UNUSED_75:
case trigger_type_e::TT_UNUSED_78:
case trigger_type_e::TT_MITSU_4G63_CAM:
initializeMitsubishi4g63Cam(this);
break;
case trigger_type_e::TT_UNUSED_78:
initialize36_2_1_1_3cyl(this);
break;
case trigger_type_e::TT_MITSU_4G9x_CAM:
initializeMitsubishi4g9xCam(this);
break;

View File

@ -82,6 +82,14 @@ public:
* For example pick-up in distributor with mechanical ignition firing order control.
*/
bool shapeWithoutTdc = false;
// 3 cylinder negatively affects sync on crank patter, let's handle it as a special kind of cam
bool isMitsubicha = false;
int getMitsubichaMult() const {
return isMitsubicha ? 2 : 1;
}
/**
* this flag tells us if we should ignore events on second input channel
* that's the way to ignore noise from the disconnected wire

View File

@ -304,7 +304,7 @@ bool TriggerDecoderBase::validateEventCounters(const TriggerWaveform& triggerSha
// We can check if things are fine by comparing the number of events in a cycle with the expected number of event.
bool isDecodingError = false;
for (int i = 0;i < PWM_PHASE_MAX_WAVE_PER_PWM;i++) {
isDecodingError |= (currentCycle.eventCount[i] != triggerShape.getExpectedEventCount((TriggerWheel)i));
isDecodingError |= (triggerShape.getMitsubichaMult() * currentCycle.eventCount[i] != triggerShape.getExpectedEventCount((TriggerWheel)i));
}
#if EFI_UNIT_TEST

View File

@ -107,7 +107,7 @@ void TriggerStimulatorHelper::assertSyncPosition(
}
int revolutionCounter = state.getCrankSynchronizationCounter();
if (revolutionCounter != TEST_REVOLUTIONS) {
if (revolutionCounter != TEST_REVOLUTIONS * shape.getMitsubichaMult()) {
warning(ObdCode::CUSTOM_OBD_TRIGGER_WAVEFORM, "sync failed/wrong gap parameters trigger=%s revolutionCounter=%d",
getTrigger_type_e(triggerConfiguration.TriggerType.type),
revolutionCounter);