2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file test_engine.cpp
|
|
|
|
*
|
2017-01-06 07:04:41 -08:00
|
|
|
* set engine_type 26
|
2016-08-20 18:03:09 -07:00
|
|
|
* VVT
|
2017-01-06 07:04:41 -08:00
|
|
|
* set engine_type 45
|
2015-07-10 06:01:56 -07:00
|
|
|
*
|
2017-03-19 13:25:15 -07:00
|
|
|
* See also custom_engine.cpp
|
|
|
|
*
|
2015-07-10 06:01:56 -07:00
|
|
|
* @date Nov 14, 2014
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2021-08-03 19:05:01 -07:00
|
|
|
#include "pch.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
#include "test_engine.h"
|
|
|
|
|
2020-08-25 13:19:23 -07:00
|
|
|
// TEST_ENGINE
|
2021-12-07 18:08:25 -08:00
|
|
|
void setTestCamEngineConfiguration() {
|
2021-11-16 01:15:29 -08:00
|
|
|
setDefaultFrankensoConfiguration();
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE;
|
2022-04-03 03:58:25 -07:00
|
|
|
setCamOperationMode();
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2016-08-20 20:02:09 -07:00
|
|
|
// engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
2016-08-20 18:03:09 -07:00
|
|
|
// trigger_config_s *triggerConfig = &engineConfiguration->trigger;
|
|
|
|
// triggerConfig->customTotalToothCount = 60;
|
|
|
|
// triggerConfig->customSkippedToothCount = 0;
|
2016-11-08 22:02:15 -08:00
|
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2016-08-27 08:02:34 -07:00
|
|
|
engineConfiguration->mafAdcChannel = EFI_ADC_1;
|
2020-09-06 15:25:26 -07:00
|
|
|
engineConfiguration->tps1_1AdcChannel = EFI_ADC_2;
|
2015-07-10 06:01:56 -07:00
|
|
|
engineConfiguration->vbattAdcChannel = EFI_ADC_NONE;
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
setWholeIatCorrTimingTable(0);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2020-10-26 15:15:17 -07:00
|
|
|
// Many tests were written when the default target AFR was 14.0, so use that for tests by default.
|
2021-11-02 15:59:19 -07:00
|
|
|
engineConfiguration->stoichRatioPrimary = 14.0f;
|
2020-10-26 15:15:17 -07:00
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
engineConfiguration->ignitionMode = IM_ONE_COIL;
|
2021-11-16 01:15:29 -08:00
|
|
|
setConstantDwell(3); // 50% duty cycle @ 5000 rpm
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
|
|
|
|
|
|
|
|
engineConfiguration->ignitionPins[0] = GPIOC_7; // #1
|
|
|
|
engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; // #2
|
|
|
|
engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; // #3
|
|
|
|
engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; // #4
|
|
|
|
engineConfiguration->ignitionPins[4] = GPIO_UNASSIGNED; // #5
|
|
|
|
engineConfiguration->ignitionPins[5] = GPIO_UNASSIGNED; // #6
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
2016-08-20 18:03:09 -07:00
|
|
|
|
2021-12-07 18:08:25 -08:00
|
|
|
|
|
|
|
void setTestCrankEngineConfiguration() {
|
|
|
|
setTestCamEngineConfiguration();
|
|
|
|
|
2021-12-30 22:21:21 -08:00
|
|
|
engineConfiguration->trigger.type = TT_ONE;
|
|
|
|
|
2022-04-02 23:21:37 -07:00
|
|
|
setCrankOperationMode();
|
2022-04-02 20:50:39 -07:00
|
|
|
// this is related to 'setDefaultBaseEngine' having 'skippedWheelOnCam = true' which is a weird fact by itself
|
|
|
|
engineConfiguration->skippedWheelOnCam = false;
|
2021-12-07 18:08:25 -08:00
|
|
|
}
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setTestVVTEngineConfiguration() {
|
|
|
|
setDefaultFrankensoConfiguration();
|
2022-04-02 23:21:37 -07:00
|
|
|
setCrankOperationMode();
|
2016-08-20 18:03:09 -07:00
|
|
|
|
|
|
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
|
|
|
engineConfiguration->trigger.customTotalToothCount = 3;
|
|
|
|
engineConfiguration->trigger.customSkippedToothCount = 1;
|
|
|
|
|
2017-01-06 07:04:41 -08:00
|
|
|
// set algorithm 3
|
2021-11-16 01:15:29 -08:00
|
|
|
setAlgorithm(LM_SPEED_DENSITY);
|
2016-08-20 18:03:09 -07:00
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
|
2019-07-12 11:24:45 -07:00
|
|
|
engineConfiguration->camInputs[0] = GPIOA_5;
|
2016-08-20 20:02:09 -07:00
|
|
|
|
2017-01-06 07:04:41 -08:00
|
|
|
// set global_trigger_offset_angle 0
|
2016-08-23 20:03:01 -07:00
|
|
|
engineConfiguration->globalTriggerAngleOffset = 0;
|
|
|
|
|
2021-02-08 18:50:31 -08:00
|
|
|
engineConfiguration->vvtMode[0] = VVT_SECOND_HALF;
|
2017-03-05 18:12:24 -08:00
|
|
|
}
|
|
|
|
|
2019-04-12 19:10:57 -07:00
|
|
|
#if EFI_UNIT_TEST
|
2021-11-16 01:15:29 -08:00
|
|
|
void setTestEngineIssue366both() {
|
2021-12-07 18:08:25 -08:00
|
|
|
setTestCamEngineConfiguration();
|
2016-08-20 20:02:09 -07:00
|
|
|
|
2017-03-06 14:42:16 -08:00
|
|
|
|
|
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
|
|
|
|
engineConfiguration->trigger.customTotalToothCount = 2;
|
|
|
|
engineConfiguration->trigger.customSkippedToothCount = 1;
|
|
|
|
|
|
|
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setTestEngineIssue366rise() {
|
|
|
|
setTestEngineIssue366both();
|
2017-03-06 14:42:16 -08:00
|
|
|
|
|
|
|
|
|
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
2016-08-20 18:03:09 -07:00
|
|
|
}
|
2017-03-06 14:42:16 -08:00
|
|
|
#endif /* EFI_UNIT_TEST */
|
2021-02-03 11:34:48 -08:00
|
|
|
|
|
|
|
#ifdef HARDWARE_CI
|
2021-11-16 01:15:29 -08:00
|
|
|
void setProteusAnalogPwmTest() {
|
2021-02-03 11:34:48 -08:00
|
|
|
// lowest cpu trigger possible
|
|
|
|
engineConfiguration->trigger.type = TT_ONE;
|
|
|
|
|
|
|
|
// Disable trigger stim
|
|
|
|
engineConfiguration->triggerSimulatorPins[0] = GPIO_UNASSIGNED;
|
|
|
|
engineConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
|
|
|
|
engineConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
|
|
|
|
|
|
|
|
// The idle control pin is connected to the default TPS input, analog volt 2
|
|
|
|
engineConfiguration->idle.solenoidPin = GPIOG_4;
|
2021-03-07 14:32:04 -08:00
|
|
|
|
|
|
|
// 5893hz is coprime with the analog sample rate, 500hz, so hopefully we get less aliasing
|
|
|
|
engineConfiguration->idle.solenoidFrequency = 5893;
|
2021-02-03 11:34:48 -08:00
|
|
|
|
|
|
|
// Test range is 20% to 80%
|
|
|
|
engineConfiguration->tpsMin = 200;
|
|
|
|
engineConfiguration->tpsMax = 800;
|
|
|
|
}
|
|
|
|
#endif
|