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
|
2019-05-03 15:41:43 -07:00
|
|
|
void setTestEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2019-11-03 18:29:12 -08:00
|
|
|
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
|
|
|
|
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE;
|
|
|
|
|
2016-08-20 20:02:09 -07:00
|
|
|
// setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
|
|
|
// 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;
|
|
|
|
|
2019-05-03 15:41:43 -07:00
|
|
|
setWholeIatCorrTimingTable(0 PASS_CONFIG_PARAMETER_SUFFIX);
|
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.
|
|
|
|
engineConfiguration->stoichRatioPrimary = 140;
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
engineConfiguration->ignitionMode = IM_ONE_COIL;
|
2019-05-03 15:41:43 -07:00
|
|
|
setConstantDwell(3 PASS_CONFIG_PARAMETER_SUFFIX); // 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
|
|
|
|
2019-05-03 15:41:43 -07:00
|
|
|
void setTestVVTEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
2019-11-03 16:36:56 -08:00
|
|
|
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
2016-08-20 18:03:09 -07:00
|
|
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
|
|
|
|
|
|
|
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
|
2019-01-10 16:25:07 -08:00
|
|
|
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
|
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;
|
2016-09-17 16:02:34 -07:00
|
|
|
engineConfiguration->debugMode = DBG_VVT;
|
2017-03-05 18:12:24 -08:00
|
|
|
}
|
|
|
|
|
2019-04-12 19:10:57 -07:00
|
|
|
#if EFI_UNIT_TEST
|
2019-05-03 15:41:43 -07:00
|
|
|
void setTestEngineIssue366both(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setTestEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-05-03 15:41:43 -07:00
|
|
|
void setTestEngineIssue366rise(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
setTestEngineIssue366both(PASS_CONFIG_PARAMETER_SIGNATURE);
|
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
|
|
|
|
void setProteusAnalogPwmTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|
|
|
// 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
|