Compare commits

...

2 Commits

Author SHA1 Message Date
rusefi 9b2a711d7e Usability: critical error in case of unneeded second channel #6419 2024-04-26 21:27:53 -04:00
Matthew Kennedy 45239870ad only: minor cleanup 2024-04-26 21:00:51 -04:00
11 changed files with 24 additions and 13 deletions

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

@ -87,5 +87,5 @@ void setFordInline6() {
engineConfiguration->mafAdcChannel = EFI_ADC_1;
engineConfiguration->triggerInputPins[0] = Gpio::A8;
engineConfiguration->triggerInputPins[1] = Gpio::A5;
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned;
}

View File

@ -48,6 +48,9 @@ void setFordAspireEngineConfiguration() {
engineConfiguration->tpsMax = 750;
engineConfiguration->rpmHardLimit = 7000;
#if HW_FRANKENSO
engineConfiguration->triggerInputPins[1] = Gpio::A5;
#endif
/**
* 18K Ohm @ -20C

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

@ -196,13 +196,11 @@ public class CommonFunctionalTest extends RusefiTestBase {
EcuTestHelper.assertSomewhatClose("VBatt", 12, SensorCentral.getInstance().getValue(Sensor.VBATT));
chart = nextChart();
double x = 100;
assertWaveNotNull(msg, chart, EngineChart.SPARK_1);
assertWaveNull(msg, chart, EngineChart.SPARK_2);
assertWaveNotNull(msg, chart, EngineChart.SPARK_3);
assertWaveNull(msg, chart, EngineChart.SPARK_4);
x = 176.856;
// todo: why is width precision so low here? is that because of loaded Windows with 1ms precision?
double widthRatio = 0.25;
// WAT? this was just 0.009733333333333387?
@ -216,14 +214,12 @@ public class CommonFunctionalTest extends RusefiTestBase {
ecu.changeRpm(2700);
ecu.changeRpm(2000);
chart = nextChart();
x = 104.0;
assertWaveNotNull(msg, chart, EngineChart.SPARK_1);
assertWaveNull(msg, chart, EngineChart.SPARK_2);
assertWaveNotNull(msg, chart, EngineChart.SPARK_3);
assertWaveNull(msg, chart, EngineChart.SPARK_4);
chart = nextChart();
x = 74;
assertWaveNotNull(msg, chart, EngineChart.INJECTOR_1);
assertWaveNotNull(msg, chart, EngineChart.INJECTOR_2);
assertWaveNotNull(msg, chart, EngineChart.INJECTOR_3);
@ -238,12 +234,10 @@ public class CommonFunctionalTest extends RusefiTestBase {
ecu.sendCommand("set_whole_timing_map 520");
chart = nextChart();
x = 328;
assertWaveNotNull(msg, chart, EngineChart.SPARK_1);
ecu.sendCommand("set_whole_timing_map 0");
chart = nextChart();
x = 128;
assertWaveNotNull(msg, chart, EngineChart.SPARK_1);
}

View File

@ -20,6 +20,7 @@ GTEST_API_ int main(int argc, char **argv) {
* See TEST_FROM_TRIGGER_ID to limit test just for last trigger
*/
// setVerboseTrigger(true);
// --gtest_filter=*TEST_NAME*
//::testing::GTEST_FLAG(filter) = "*AllTriggersFixture*";
int result = RUN_ALL_TESTS();
// windows ERRORLEVEL in Jenkins batch file seems to want negative value to detect failure

View File

@ -23,11 +23,11 @@ static void assertNextEvent(const char *msg, int expectedPinState, TestExecutor
timeNowUs = expectedTimeOfNextEvent;
// execute pending actions and assert that only one action was executed
ASSERT_NEAR(1, executor->executeAll(timeNowUs), 0) << msg << " executed";
ASSERT_NEAR(expectedPinState, pin.currentLogicValue, 0) << msg << " pin state";
ASSERT_EQ(1, executor->executeAll(timeNowUs) << msg << " executed";
ASSERT_EQ(expectedPinState, pin.currentLogicValue) << msg << " pin state";
// assert that we have one new action in queue
ASSERT_EQ( 1, executor->size()) << "PWM_test: queue.size";
ASSERT_EQ(1, executor->size()) << "PWM_test: queue.size";
}
static void test100dutyCycle() {

View File

@ -79,6 +79,7 @@ TEST(trigger, testNoisyInput) {
TEST(trigger, testCamInput) {
// setting some weird engine
EngineTestHelper eth(engine_type_e::FORD_ESCORT_GT);
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned;
// changing to 'ONE TOOTH' trigger on CRANK with CAM/VVT
setCrankOperationMode();

View File

@ -8,6 +8,7 @@
TEST(trigger, testQuadCamInput) {
// setting some weird engine
EngineTestHelper eth(engine_type_e::FORD_ESCORT_GT);
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned;
engineConfiguration->isFasterEngineSpinUpEnabled = false;
engineConfiguration->alwaysInstantRpm = true;

View File

@ -174,6 +174,7 @@ extern bool debugSignalExecutor;
TEST(misc, testRpmCalculator) {
EngineTestHelper eth(engine_type_e::FORD_INLINE_6_1995);
efiAssertVoid(ObdCode::CUSTOM_ERR_6670, engineConfiguration!=NULL, "null config in engine");
setTable(config->injectionPhase, -180.0f);
@ -190,8 +191,6 @@ TEST(misc, testRpmCalculator) {
ASSERT_EQ( 720, engine->engineState.engineCycle) << "engineCycle";
efiAssertVoid(ObdCode::CUSTOM_ERR_6670, engineConfiguration!=NULL, "null config in engine");
engineConfiguration->minimumIgnitionTiming = -15;
float timingAdvance = -13;
setWholeTimingTable(timingAdvance);

View File

@ -44,6 +44,7 @@ static auto makeTriggerShape(operation_mode_e mode, const TriggerConfiguration&
TEST(TriggerDecoder, FindsFirstSyncPoint) {
MockTriggerConfiguration cfg({trigger_type_e::TT_TOOTHED_WHEEL, 4, 1});
cfg.update();
engineConfiguration = nullptr;
auto shape = makeTriggerShape(FOUR_STROKE_CAM_SENSOR, cfg);