VQ trigger gaps improvement fix #4469

nice, unit test is happier!
This commit is contained in:
rusefillc 2022-08-23 23:32:14 -04:00
parent 42f02c67a3
commit f5576b05d9
3 changed files with 9 additions and 5 deletions

View File

@ -31,6 +31,7 @@ Release template (copy/paste this for new release):
- Inverted vvt control #4464 - Inverted vvt control #4464
- Lua canRxAdd bus parameter handling #4467 - Lua canRxAdd bus parameter handling #4467
- STM32Bootloader driver install from console requests elevation #4313 - STM32Bootloader driver install from console requests elevation #4313
- VQ trigger gaps improvement #4469
### Removed ### Removed

View File

@ -64,7 +64,6 @@ void initializeNissanVQvvt(TriggerWaveform *s) {
} }
void makeNissanPattern(TriggerWaveform* s, size_t halfCylinderCount, size_t totalWheel, size_t missing) { void makeNissanPattern(TriggerWaveform* s, size_t halfCylinderCount, size_t totalWheel, size_t missing) {
s->setTriggerSynchronizationGap(0.33);
auto toothAngle = 360.0f / totalWheel; auto toothAngle = 360.0f / totalWheel;
@ -83,9 +82,13 @@ void initializeNissanVQ35crank(TriggerWaveform *s) {
s->initialize(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR); s->initialize(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR);
s->tdcPosition = 675; s->tdcPosition = 675;
s->useRiseEdge = true;
// 6 cylinder = 36 tooth wheel, missing 2 teeth in 3 spots // 6 cylinder = 36 tooth wheel, missing 2 teeth in 3 spots
makeNissanPattern(s, 3, 36, 2); makeNissanPattern(s, 3, 36, 2);
s->setTriggerSynchronizationGap3(/*gapIndex*/0, 0.2, 0.5);
s->setTriggerSynchronizationGap3(/*gapIndex*/1, 2, 4);
s->setTriggerSynchronizationGap3(/*gapIndex*/2, 0.6, 1.4);
} }
void initializeNissanMR18crank(TriggerWaveform *s) { void initializeNissanMR18crank(TriggerWaveform *s) {
@ -95,6 +98,7 @@ void initializeNissanMR18crank(TriggerWaveform *s) {
// 4 cylinder = 36 tooth wheel, missing 2 teeth in 2 spots // 4 cylinder = 36 tooth wheel, missing 2 teeth in 2 spots
makeNissanPattern(s, 2, 36, 2); makeNissanPattern(s, 2, 36, 2);
s->setTriggerSynchronizationGap(0.33);
} }
void initializeNissanQR25crank(TriggerWaveform *s) { void initializeNissanQR25crank(TriggerWaveform *s) {

View File

@ -34,8 +34,7 @@ TEST(realCrankingVQ40, normalCranking) {
ASSERT_EQ(101, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex(); ASSERT_EQ(101, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
// TODO: why warnings? // TODO: why warnings?
ASSERT_EQ(3, eth.recentWarnings()->getCount()); ASSERT_EQ(2, eth.recentWarnings()->getCount());
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, eth.recentWarnings()->get(0).Code); ASSERT_EQ(CUSTOM_OUT_OF_ORDER_COIL, eth.recentWarnings()->get(0).Code); // this is from a coil being protected by overdwell protection
ASSERT_EQ(CUSTOM_OUT_OF_ORDER_COIL, eth.recentWarnings()->get(1).Code); // this is from a coil being protected by overdwell protection ASSERT_EQ(CUSTOM_SYNC_ERROR, eth.recentWarnings()->get(1).Code);
ASSERT_EQ(CUSTOM_SYNC_ERROR, eth.recentWarnings()->get(2).Code);
} }