Compare commits

...

2 Commits

Author SHA1 Message Date
Matthew Kennedy b5e3694647 no need for getTimeNowUs on ETH 2024-04-27 09:55:49 -04:00
rusefi 4744515cf5 Usability: critical error in case of unneeded second channel fix #6419 2024-04-27 08:01:59 -04:00
8 changed files with 19 additions and 12 deletions

View File

@ -30,6 +30,7 @@ Release template (copy/paste this for new release):
- "60/2 VW" trigger wheel renamed to "60-2 Wrong Polarity" #988
- exhaust VVTs now use it's onw Edge Select setting
- removing weird 1+16 trigger wheel #6418
- critical error in case of unneeded second channel #6419
## Unreleased

View File

@ -111,7 +111,7 @@ void setBoardDefaultConfiguration() {
engineConfiguration->triggerSimulatorPins[1] = Gpio::D2;
engineConfiguration->triggerInputPins[0] = Gpio::C6;
engineConfiguration->triggerInputPins[1] = Gpio::A5;
// engineConfiguration->triggerInputPins[1] = Gpio::A5;
// set this to SPI_DEVICE_3 to enable stimulation
//engineConfiguration->digitalPotentiometerSpiDevice = SPI_DEVICE_3;

View File

@ -771,6 +771,17 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e triggerOperatio
warning(ObdCode::CUSTOM_ERR_NO_SHAPE, "initializeTriggerWaveform() not implemented: %d", triggerType.type);
}
if (!needSecondTriggerInput &&
#if EFI_UNIT_TEST
engineConfiguration != nullptr &&
#endif
engineConfiguration->triggerInputPins[1] != Gpio::Unassigned) {
// todo: technical debt: HW CI should not require special treatment
#ifndef HARDWARE_CI
criticalError("Single-channel trigger %s selected while two inputs were configured", getTrigger_type_e(triggerType.type));
#endif
}
/**
* Feb 2019 suggestion: it would be an improvement to remove 'expectedEventCount' logic from 'addEvent'
* and move it here, after all events were added.

View File

@ -278,10 +278,6 @@ void EngineTestHelper::setTimeAndInvokeEventsUs(int targetTime) {
timeNowUs = targetTime;
}
efitimeus_t EngineTestHelper::getTimeNowUs() {
return timeNowUs;
}
void EngineTestHelper::fireTriggerEvents(int count) {
fireTriggerEvents2(count, 5); // 5ms
}

View File

@ -104,7 +104,6 @@ public:
int executeActions();
void moveTimeForwardMs(float deltaTimeMs);
void moveTimeForwardSec(float deltaTimeSec);
efitimeus_t getTimeNowUs();
Engine engine;
persistent_config_s persistentConfig;

View File

@ -54,7 +54,7 @@ TEST(OddFireRunningMode, hd) {
eth.assertRpm( 500, "spinning-RPM#1");
engine->executor.executeAll(eth.getTimeNowUs() + MS2US(1000000));
engine->executor.executeAll(getTimeNowUs() + MS2US(1000000));
eth.fireTriggerEvents2(2 /* count */ , 60 /* ms */);
ASSERT_EQ(IM_SEQUENTIAL, getCurrentInjectionMode());

View File

@ -222,7 +222,7 @@ TEST(misc, testRpmCalculator) {
eth.moveTimeForwardMs(5 /*ms*/);
int start = eth.getTimeNowUs();
int start = getTimeNowUs();
ASSERT_EQ( 485000, start) << "start value";
engine->periodicFastCallback();
@ -928,11 +928,11 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
// assertInjectorDownEvent("L04@8", 8, MS2US(50.0), 0);
engine->executor.executeAll(eth.getTimeNowUs() + 1);
engine->executor.executeAll(getTimeNowUs() + 1);
// injector goes high...
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@1";
engine->executor.executeAll(eth.getTimeNowUs() + MS2US(17.5) + 1);
engine->executor.executeAll(getTimeNowUs() + MS2US(17.5) + 1);
// injector does not go low too soon, that's a feature :)
ASSERT_TRUE(enginePins.injectors[0].currentLogicValue) << "injector@2";
@ -948,7 +948,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
//todo assertInjectorDownEvent("L015@5", 5, MS2US(30), 0);
engine->executor.executeAll(eth.getTimeNowUs() + MS2US(10) + 1);
engine->executor.executeAll(getTimeNowUs() + MS2US(10) + 1);
// end of combined injection
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@3";

View File

@ -48,7 +48,7 @@ static void simulateTrigger(EngineTestHelper &eth, TriggerAdcDetector &trigAdcSt
static const float Vil = 0.3f * adcMaxVoltage;
static const float Vih = 0.7f * adcMaxVoltage;
efitimeus_t startUs = eth.getTimeNowUs();
efitimeus_t startUs = getTimeNowUs();
int prevLogicValue = -1;
while (reader.haveMore()) {