2020-12-14 21:09:35 -08:00
|
|
|
/*
|
|
|
|
* m111.cpp
|
|
|
|
*
|
|
|
|
* @date Dec 14, 2020
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "m111.h"
|
2023-03-27 21:13:10 -07:00
|
|
|
#include "thermistors.h"
|
2023-03-29 14:00:23 -07:00
|
|
|
#include "defaults.h"
|
2020-12-14 21:09:35 -08:00
|
|
|
|
2023-03-27 15:46:17 -07:00
|
|
|
#if HW_PROTEUS
|
|
|
|
#include "proteus_meta.h"
|
|
|
|
#endif // HW_PROTEUS
|
|
|
|
|
2023-04-11 08:35:22 -07:00
|
|
|
#if HW_MICRO_RUSEFI
|
2023-03-31 20:34:47 -07:00
|
|
|
#include "mre_meta.h"
|
2023-04-11 08:35:22 -07:00
|
|
|
#endif // HW_MICRO_RUSEFI
|
2023-03-31 20:34:47 -07:00
|
|
|
|
2023-03-27 15:46:17 -07:00
|
|
|
void setM111EngineConfiguration() {
|
2023-04-28 18:01:08 -07:00
|
|
|
engineConfiguration->cylindersCount = 4;
|
|
|
|
engineConfiguration->firingOrder = FO_1_3_4_2;
|
|
|
|
engineConfiguration->displacement = 2.295f;
|
2023-03-27 15:46:17 -07:00
|
|
|
|
|
|
|
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
|
|
|
|
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
|
|
|
|
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
|
|
|
|
|
|
|
strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MERCEDES);
|
|
|
|
strcpy(engineConfiguration->engineCode, "M111");
|
2020-12-14 21:09:35 -08:00
|
|
|
|
2023-03-27 21:13:10 -07:00
|
|
|
engineConfiguration->vvtMode[0] = VVT_FIRST_HALF;
|
2023-03-27 15:46:17 -07:00
|
|
|
engineConfiguration->globalTriggerAngleOffset = 109; // please use a timing light?
|
2023-03-27 21:13:10 -07:00
|
|
|
|
2023-04-08 07:00:00 -07:00
|
|
|
// todo: i wonder if we have less custom curve for same sensor?
|
2023-03-27 21:13:10 -07:00
|
|
|
setAtSensor(&engineConfiguration->iat, /*temp low*/0, 7400, /*temp mid*/22, 2180, /*temp high*/ 100, 180);
|
2023-04-08 07:00:00 -07:00
|
|
|
// todo: i wonder if these custom IAT and CLT curves are effectively same?
|
|
|
|
setAtSensor(&engineConfiguration->clt, /*temp low*/0, 5750, /*temp mid*/30, 1750, /*temp high*/ 50, 750);
|
2023-03-27 21:13:10 -07:00
|
|
|
|
|
|
|
engineConfiguration->map.sensor.type = MT_CUSTOM;
|
|
|
|
// GM TMAP is recommended
|
|
|
|
engineConfiguration->map.sensor.lowValue = 20;
|
|
|
|
engineConfiguration->mapLowValueVoltage = 0.3;
|
|
|
|
engineConfiguration->map.sensor.highValue = 250;
|
|
|
|
engineConfiguration->mapHighValueVoltage = 4.65;
|
2023-04-02 15:43:11 -07:00
|
|
|
|
2023-06-07 15:39:46 -07:00
|
|
|
engineConfiguration->idle.solenoidPin = Gpio::Unassigned;
|
2023-04-02 15:43:11 -07:00
|
|
|
engineConfiguration->etb.pFactor = 5.12;
|
|
|
|
engineConfiguration->etb.iFactor = 47;
|
|
|
|
engineConfiguration->etb.dFactor = 0.088;
|
|
|
|
engineConfiguration->etb.offset = 0;
|
2023-04-11 08:35:22 -07:00
|
|
|
|
|
|
|
gppwm_channel *scBypass = &engineConfiguration->gppwm[0];
|
|
|
|
strcpy(engineConfiguration->gpPwmNote[0], "SC Bypass");
|
2023-04-11 08:38:07 -07:00
|
|
|
#if HW_MICRO_RUSEFI && EFI_PROD_CODE
|
2023-04-11 08:35:22 -07:00
|
|
|
scBypass->pin = MRE_GPOUT_3;
|
|
|
|
#endif // HW_MICRO_RUSEFI
|
|
|
|
|
|
|
|
gppwm_channel *scClutch = &engineConfiguration->gppwm[1];
|
|
|
|
#if HW_MICRO_RUSEFI
|
|
|
|
scClutch->pin = MRE_LS_2;
|
2023-05-21 18:45:05 -07:00
|
|
|
engineConfiguration->vvtPins[0] = MRE_LS_1;
|
2023-04-11 08:35:22 -07:00
|
|
|
#endif // HW_MICRO_RUSEFI
|
|
|
|
strcpy(engineConfiguration->gpPwmNote[1], "SC Clutch");
|
|
|
|
|
2020-12-14 21:09:35 -08:00
|
|
|
}
|
2023-03-27 15:46:17 -07:00
|
|
|
|
|
|
|
void setMreM111EngineConfiguration() {
|
|
|
|
setM111EngineConfiguration();
|
2023-03-31 20:34:47 -07:00
|
|
|
|
2023-04-11 08:35:22 -07:00
|
|
|
#if HW_MICRO_RUSEFI
|
2023-04-26 17:36:30 -07:00
|
|
|
engineConfiguration->fuelPumpPin = MRE_GPOUT_1; // more or less MRE default
|
|
|
|
engineConfiguration->fanPin = MRE_GPOUT_2; // more or less MRE default
|
2023-03-31 20:34:47 -07:00
|
|
|
setPPSInputs(MRE_IN_PPS, MRE_IN_PPS2);
|
2023-04-01 18:07:43 -07:00
|
|
|
setTPS1Inputs(MRE_IN_TPS, MRE_IN_TPS2);
|
2023-04-17 17:32:55 -07:00
|
|
|
|
|
|
|
engineConfiguration->oilPressure.hwChannel = MRE_IN_ANALOG_VOLT_4;
|
2023-04-18 12:36:58 -07:00
|
|
|
// assumes R30 is populated
|
|
|
|
engineConfiguration->boostControlPin = MRE_AV9_REUSE;
|
2023-04-11 08:35:22 -07:00
|
|
|
#endif // HW_MICRO_RUSEFI
|
2023-04-02 15:43:11 -07:00
|
|
|
// note how these numbers are very flipped hyundai154 defaults?
|
|
|
|
setTPS1Calibration(891, 69, 98, 926);
|
|
|
|
// honda cable position sensor
|
|
|
|
setPPSCalibration(0.38, 4.77, 4.64, 2.47);
|
2023-03-27 15:46:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void setProteusM111EngineConfiguration() {
|
|
|
|
setM111EngineConfiguration();
|
|
|
|
#if HW_PROTEUS
|
2023-03-27 21:13:10 -07:00
|
|
|
engineConfiguration->triggerInputPins[0] = PROTEUS_VR_1;
|
|
|
|
engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_2;
|
2023-03-29 13:52:33 -07:00
|
|
|
|
|
|
|
engineConfiguration->tps1_2AdcChannel = PROTEUS_IN_TPS1_2;
|
|
|
|
setPPSInputs(PROTEUS_IN_PPS, PROTEUS_IN_PPS2);
|
2023-03-27 15:46:17 -07:00
|
|
|
#endif // HW_PROTEUS
|
|
|
|
}
|