fix 36-2-1 trigger (#4645)
* fix * test files * test real 4b11 * test.mk * better angle error math * test GM too * changelog
This commit is contained in:
parent
83cdbdd0b4
commit
aa881efe89
|
@ -39,6 +39,7 @@ Release template (copy/paste this for new release):
|
|||
### Fixed
|
||||
- Fuel Priming reset fix #4627
|
||||
- Slower than expected RPM information was slowing engine start #4629
|
||||
- Fix 36-2-1 trigger (Mitsubishi 4B11, etc) #4635
|
||||
|
||||
## September 2022 Release - "Day 203"
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ void initialize36_2_1_1(TriggerWaveform *s) {
|
|||
s->setSecondTriggerSynchronizationGap(1); // redundancy
|
||||
}
|
||||
|
||||
// Mitsubishi 4B11
|
||||
void initialize36_2_1(TriggerWaveform *s) {
|
||||
s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);
|
||||
s->tdcPosition = 90;
|
||||
|
@ -94,16 +95,16 @@ void initialize36_2_1(TriggerWaveform *s) {
|
|||
|
||||
float oneTooth = 720 / totalTeethCount;
|
||||
|
||||
float offset = (36 - 17 - 2 - 16) * oneTooth;
|
||||
|
||||
addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
|
||||
NO_LEFT_FILTER, offset + 17 * oneTooth + 1);
|
||||
|
||||
offset += (17 + 2) * oneTooth;
|
||||
float offset = (36 - 16 - 2 - 17) * oneTooth;
|
||||
|
||||
addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
|
||||
NO_LEFT_FILTER, offset + 16 * oneTooth + 1);
|
||||
|
||||
offset += (16 + 2) * oneTooth;
|
||||
|
||||
addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle,
|
||||
NO_LEFT_FILTER, offset + 17 * oneTooth + 1);
|
||||
|
||||
|
||||
s->setTriggerSynchronizationGap(3);
|
||||
s->setSecondTriggerSynchronizationGap(1); // redundancy
|
||||
|
|
|
@ -703,7 +703,14 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
|||
// basically, check that the tooth width is correct
|
||||
auto estimatedCurrentPhase = getCurrentEnginePhase(timestamp);
|
||||
if (estimatedCurrentPhase) {
|
||||
triggerToothAngleError = expectedNextPhase - estimatedCurrentPhase.Value;
|
||||
float angleError = expectedNextPhase - estimatedCurrentPhase.Value;
|
||||
|
||||
float cycle = getEngineState()->engineCycle;
|
||||
while (angleError < -cycle / 2) {
|
||||
angleError += cycle;
|
||||
}
|
||||
|
||||
triggerToothAngleError = angleError;
|
||||
}
|
||||
|
||||
// Record precise time and phase of the engine. This is used for VVT decode, and to check that the
|
||||
|
|
|
@ -13,6 +13,7 @@ TESTS_SRC_CPP = \
|
|||
tests/trigger/test_real_cranking_miata_na6.cpp \
|
||||
tests/trigger/test_real_cranking_nissan_vq40.cpp \
|
||||
tests/trigger/test_trigger_skipped_wheel.cpp \
|
||||
tests/trigger/test_real_4b11.cpp \
|
||||
tests/trigger/test_real_volkswagen.cpp \
|
||||
tests/trigger/test_real_nb2_cranking.cpp \
|
||||
tests/trigger/test_real_gm_24x.cpp \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,42 @@
|
|||
// Mitsubishi 4B11 trigger pattern
|
||||
// Crank: 36-2-1
|
||||
// Cam: Single tooth (half moon)
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include "logicdata_csv_reader.h"
|
||||
|
||||
TEST(real4b11, running) {
|
||||
CsvReader reader(1, /* vvtCount */ 0);
|
||||
|
||||
reader.open("tests/trigger/resources/4b11-running.csv");
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
||||
engineConfiguration->alwaysInstantRpm = true;
|
||||
|
||||
eth.setTriggerType(TT_36_2_1);
|
||||
|
||||
int eventCount = 0;
|
||||
bool gotRpm = false;
|
||||
|
||||
while (reader.haveMore()) {
|
||||
reader.processLine(ð);
|
||||
eventCount++;
|
||||
engine->rpmCalculator.onSlowCallback();
|
||||
|
||||
// Expect that all teeth are in the correct spot
|
||||
float angleError = getTriggerCentral()->triggerToothAngleError;
|
||||
EXPECT_TRUE(angleError < 3 && angleError > -3) << "tooth angle of " << angleError << " at timestamp " << (getTimeNowNt() / 1e8);
|
||||
|
||||
auto rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
if (!gotRpm && rpm) {
|
||||
gotRpm = true;
|
||||
|
||||
// We should get first RPM on exactly the first sync point - this means the instant RPM pre-sync event copy all worked OK
|
||||
EXPECT_EQ(eventCount, 30);
|
||||
EXPECT_NEAR(rpm, 1436.23f, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_EQ(0, eth.recentWarnings()->getCount());
|
||||
}
|
|
@ -21,6 +21,10 @@ TEST(crankingGm24x, gmRealCrankingFromFile) {
|
|||
|
||||
engine->rpmCalculator.onSlowCallback();
|
||||
|
||||
// Expect that all teeth are in the correct spot
|
||||
float angleError = getTriggerCentral()->triggerToothAngleError;
|
||||
EXPECT_TRUE(angleError < 3 && angleError > -3) << "tooth angle of " << angleError << " at timestamp " << (getTimeNowNt() / 1e8);
|
||||
|
||||
auto rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
if (!gotRpm && rpm) {
|
||||
gotRpm = true;
|
||||
|
|
Loading…
Reference in New Issue