rusefi/firmware/config/engines/canam.cpp

119 lines
4.2 KiB
C++
Raw Normal View History

2023-09-19 13:50:52 -07:00
#include "pch.h"
#include "defaults.h"
#include "proteus_meta.h"
#include "canam.h"
2023-12-25 00:02:41 -08:00
#include "canam_canned.cpp"
2023-09-21 11:16:09 -07:00
#include "lua_lib.h"
2023-09-19 13:50:52 -07:00
// set engine_type 54
2023-09-19 14:01:57 -07:00
// https://www.youtube.com/watch?v=j8DOFp02QDY
2023-09-19 13:50:52 -07:00
void setMaverickX3() {
2023-09-19 14:01:57 -07:00
strcpy(engineConfiguration->engineMake, "Rotax");
strcpy(engineConfiguration->engineCode, "900 ACE");
2023-09-19 13:50:52 -07:00
engineConfiguration->cylindersCount = 3;
2023-09-20 09:50:31 -07:00
engineConfiguration->firingOrder = FO_1_2_3;
2023-09-21 11:16:09 -07:00
engineConfiguration->displacement = 0.9;
2023-09-19 13:50:52 -07:00
engineConfiguration->injectionMode = IM_SEQUENTIAL;
2023-12-19 03:02:44 -08:00
// ? engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
2023-09-19 13:50:52 -07:00
2024-01-02 07:27:06 -08:00
// portion of this file was generated by TuneCanTool.java
2023-12-25 00:02:41 -08:00
engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_36_2;
2023-12-25 22:09:40 -08:00
engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
2023-12-25 00:02:41 -08:00
engineConfiguration->isForcedInduction = true;
engineConfiguration->vvtOffsets[0] = 116;
2023-12-29 08:34:42 -08:00
engineConfiguration->injector.flow = 320;
engineConfiguration->etbIdleThrottleRange = 10;
2023-12-25 00:02:41 -08:00
engineConfiguration->iacByTpsHoldTime = 2;
engineConfiguration->iacByTpsDecayTime = 2;
2023-12-29 08:34:42 -08:00
engineConfiguration->iacByTpsTaper = 5;
2023-12-25 00:02:41 -08:00
engineConfiguration->useIdleTimingPidControl = true;
2023-12-29 08:34:42 -08:00
engineConfiguration->idleTimingSoftEntryTime = 1;
engineConfiguration->tpsAccelLookback = 0.3;
engineConfiguration->tpsAccelEnrichmentThreshold = 12;
engineConfiguration->tpsDecelEnleanmentThreshold = 7;
engineConfiguration->tpsAccelFractionPeriod = 3;
engineConfiguration->tpsAccelFractionDivisor = 0.3;
engineConfiguration->isBoostControlEnabled = true;
2023-12-25 00:02:41 -08:00
engineConfiguration->idleTimingPid.dFactor = 0.0005;
engineConfiguration->idleTimingPid.minValue = -5;
engineConfiguration->idleTimingPid.maxValue = 5;
engineConfiguration->fanOnTemperature = 87;
engineConfiguration->fanOffTemperature = 82;
engineConfiguration->disableFan1WhenStopped = true;
engineConfiguration->disableFan2WhenStopped = true;
2023-12-25 00:40:16 -08:00
engineConfiguration->fan2ExtraIdle = 0;
engineConfiguration->idlePidDeactivationTpsThreshold = 2;
engineConfiguration->useSeparateAdvanceForIdle = true;
engineConfiguration->vvtControlMinRpm = 2000;
engineConfiguration->overrideCrankingIacSetting = true;
2023-12-25 00:02:41 -08:00
engineConfiguration->startButtonSuppressOnStartUpMs = 1000;
engineConfiguration->vssToothCount = 10;
engineConfiguration->etb.pFactor = 12.0794;
engineConfiguration->etb.iFactor = 213.349;
engineConfiguration->etb.dFactor = 0.113607;
engineConfiguration->disableEtbWhenEngineStopped = true;
cannedsparkDwellValues();
canneddwellVoltageCorrValues();
cannedignitionRpmBins();
cannedignitionLoadBins();
cannedidleAdvanceBins();
cannedidleAdvance();
cannedveRpmBins();
cannedveLoadBins();
2023-12-25 00:40:16 -08:00
cannedboostRpmBins();
cannedpedalToTpsRpmBins();
2023-12-29 09:29:21 -08:00
cannedcltIdleRpm();
2023-12-25 00:40:16 -08:00
cannedcltIdleCorr();
cannedcltCrankingCorr();
2023-12-25 00:02:41 -08:00
2023-12-19 18:53:33 -08:00
setPPSCalibration(0.25, 1.49, 0.49, 2.98);
2023-12-11 10:31:20 -08:00
// todo: matches Hyundai TODO extract method?
setTPS1Calibration(98, 926, 891, 69);
2023-09-19 13:50:52 -07:00
#if HW_PROTEUS
2023-11-16 19:21:54 -08:00
engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_6;
2023-10-06 17:05:34 -07:00
engineConfiguration->vehicleSpeedSensorInputPin = PROTEUS_DIGITAL_5;
2023-09-24 14:58:19 -07:00
engineConfiguration->auxAnalogInputs[0] = PROTEUS_IN_ANALOG_VOLT_4;
2023-09-19 13:50:52 -07:00
setProteusEtbIO();
2023-09-21 11:16:09 -07:00
engineConfiguration->starterControlPin = Gpio::PROTEUS_LS_14;
engineConfiguration->startStopButtonPin = PROTEUS_IN_AV_6_DIGITAL;
2023-10-03 19:38:51 -07:00
engineConfiguration->boostControlPin = Gpio::PROTEUS_LS_16;
gppwm_channel *icFanPwm = &engineConfiguration->gppwm[0];
icFanPwm->pin = Gpio::PROTEUS_LS_15;
gppwm_channel *accRelayPwm = &engineConfiguration->gppwm[1];
accRelayPwm->pin = Gpio::PROTEUS_LS_4;
2023-11-21 17:54:07 -08:00
engineConfiguration->luaDigitalInputPins[2] = PROTEUS_IN_AV_10_DIGITAL;
engineConfiguration->luaDigitalInputPins[3] = PROTEUS_IN_AV_8_DIGITAL;
2023-09-21 11:16:09 -07:00
#endif // HW_PROTEUS
2023-12-29 08:34:42 -08:00
engineConfiguration->gppwm[0].pwmFrequency = 0;
engineConfiguration->gppwm[0].dutyIfError = 100;
engineConfiguration->gppwm[0].rpmAxis = GPPWM_Iat;
engineConfiguration->gppwm[0].loadAxis = GPPWM_Map;
2023-10-03 19:38:51 -07:00
strcpy(engineConfiguration->gpPwmNote[0], "IC Fan");
strcpy(engineConfiguration->gpPwmNote[1], "Acc Relay");
2023-09-21 11:16:09 -07:00
#if HW_PROTEUS
2023-09-21 19:06:44 -07:00
#include "canam_2021.lua"
2023-09-19 13:50:52 -07:00
#endif // HW_PROTEUS
2023-12-11 10:31:20 -08:00
}