2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file subaru.cpp
|
|
|
|
*
|
|
|
|
* SUBARU_2003_WRX
|
2017-01-06 07:04:41 -08:00
|
|
|
* set engine_type 22
|
2015-07-10 06:01:56 -07:00
|
|
|
*
|
|
|
|
* @date Sep 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 "subaru.h"
|
2016-04-03 16:01:59 -07:00
|
|
|
#include "custom_engine.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setSubaru2003Wrx() {
|
2019-12-11 14:48:55 -08:00
|
|
|
setFrankenso_01_LCD(engineConfiguration);
|
2019-01-09 21:56:08 -08:00
|
|
|
setFrankenso0_1_joystick(engineConfiguration);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
|
|
|
|
engineConfiguration->trigger.customTotalToothCount = 5;
|
|
|
|
engineConfiguration->trigger.customSkippedToothCount = 1;
|
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->useStepperIdle = true;
|
2017-01-28 22:04:16 -08:00
|
|
|
|
2017-01-29 07:04:26 -08:00
|
|
|
// See http://rusefi.com/forum/viewtopic.php?f=4&t=1161
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->idle.stepperDirectionPin = GPIOD_1; // top stepper drive pin, white wire recommended
|
|
|
|
engineConfiguration->idle.stepperStepPin = GPIOD_6; // yellow wire recommended
|
2017-01-28 22:04:16 -08:00
|
|
|
engineConfiguration->stepperEnablePin = GPIOB_1; // bottom stepper driver board pin, blue wire recommended
|
|
|
|
|
2019-12-11 14:48:55 -08:00
|
|
|
engineConfiguration->triggerSimulatorPins[0] = GPIO_UNASSIGNED; // we want to avoid PD1 conflict
|
|
|
|
engineConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
|
|
|
|
engineConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
|
2019-04-12 16:23:48 -07:00
|
|
|
}
|
|
|
|
|
2020-12-06 11:16:40 -08:00
|
|
|
/**
|
|
|
|
* MRE_SUBARU_EJ18
|
|
|
|
* set engine_type 37
|
|
|
|
*/
|
2021-11-16 01:15:29 -08:00
|
|
|
void setSubaruEJ18_MRE() {
|
2020-12-13 14:46:48 -08:00
|
|
|
engineConfiguration->trigger.type = TT_SUBARU_7_WITHOUT_6;
|
2020-12-06 11:16:40 -08:00
|
|
|
|
2020-12-13 13:38:09 -08:00
|
|
|
|
|
|
|
// CONFIG(isDoubleSolenoidIdle) = true;
|
2020-12-06 11:16:40 -08:00
|
|
|
|
2020-12-13 08:39:10 -08:00
|
|
|
engineConfiguration->specs.displacement = 1.8;
|
|
|
|
strcpy(CONFIG(engineMake), ENGINE_MAKE_SUBARU);
|
|
|
|
strcpy(CONFIG(engineCode), "EJ18");
|
|
|
|
|
|
|
|
engineConfiguration->specs.firingOrder = FO_1_3_2_4;
|
2020-12-13 13:38:09 -08:00
|
|
|
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
|
|
|
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
2020-12-13 08:39:10 -08:00
|
|
|
|
2020-12-13 12:44:14 -08:00
|
|
|
#if (BOARD_TLE8888_COUNT > 0)
|
2020-12-13 08:39:10 -08:00
|
|
|
// TLE8888_PIN_23: "33 - GP Out 3"
|
|
|
|
engineConfiguration->malfunctionIndicatorPin = TLE8888_PIN_23;
|
2020-12-13 12:44:14 -08:00
|
|
|
#endif /* BOARD_TLE8888_COUNT */
|
2020-12-13 08:39:10 -08:00
|
|
|
|
2021-01-31 09:27:26 -08:00
|
|
|
// this car has high-side main relay WOW so we have to hard wire it to ignition switch
|
2020-12-13 11:49:14 -08:00
|
|
|
|
2020-12-13 08:39:10 -08:00
|
|
|
|
2020-12-06 11:16:40 -08:00
|
|
|
}
|
2021-02-06 10:50:34 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Subaru SVX (Alcyone SVX)
|
|
|
|
*/
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setSubaruEG33Defaults() {
|
2021-02-06 10:50:34 -08:00
|
|
|
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
|
|
|
|
|
|
|
|
engineConfiguration->trigger.type = TT_SUBARU_SVX;
|
|
|
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
|
|
|
|
|
|
|
engineConfiguration->specs.cylindersCount = 6;
|
|
|
|
engineConfiguration->specs.firingOrder = FO_1_6_3_2_5_4;
|
|
|
|
|
|
|
|
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
|
|
|
|
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
|
|
|
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
|
|
|
|
|
|
|
/* TODO: */
|
|
|
|
engineConfiguration->globalTriggerAngleOffset = 114; // the end of 19th tooth?
|
|
|
|
|
2021-04-28 17:25:33 -07:00
|
|
|
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
|
2021-02-06 10:50:34 -08:00
|
|
|
|
|
|
|
engineConfiguration->specs.displacement = 3.30;
|
|
|
|
engineConfiguration->injector.flow = 250;
|
|
|
|
|
|
|
|
engineConfiguration->cranking.baseFuel = 5; // ???
|
|
|
|
engineConfiguration->cranking.rpm = 400;
|
|
|
|
|
|
|
|
engineConfiguration->rpmHardLimit = 6500;
|
|
|
|
|
|
|
|
engineConfiguration->idleStepperReactionTime = 10;
|
|
|
|
engineConfiguration->stepperDirectionPinMode = OM_INVERTED;
|
|
|
|
engineConfiguration->useLinearCltSensor = true;
|
|
|
|
|
|
|
|
engineConfiguration->canReadEnabled = true;
|
|
|
|
engineConfiguration->canWriteEnabled = false;
|
|
|
|
|
2021-05-03 06:32:14 -07:00
|
|
|
/* Fully closed - 0.9V, fully opened - 4.7 (?) */
|
|
|
|
engineConfiguration->tpsMin = convertVoltageTo10bitADC(0.9);
|
|
|
|
engineConfiguration->tpsMax = convertVoltageTo10bitADC(4.7);
|
2021-02-06 10:50:34 -08:00
|
|
|
engineConfiguration->tpsErrorDetectionTooLow = -10; // -10% open
|
|
|
|
engineConfiguration->tpsErrorDetectionTooHigh = 110; // 110% open
|
|
|
|
|
|
|
|
engineConfiguration->mapMinBufferLength = 4;
|
|
|
|
|
|
|
|
/* idle configuration */
|
|
|
|
engineConfiguration->manIdlePosition = 30;
|
|
|
|
engineConfiguration->idle.solenoidFrequency = 250;
|
|
|
|
|
|
|
|
/* Check this */
|
|
|
|
engineConfiguration->tachPulsePerRev = 2;
|
|
|
|
}
|