fome-fw/firmware/config/engines/vw_b6.cpp

95 lines
2.5 KiB
C++
Raw Normal View History

2019-12-26 18:33:12 -08:00
/*
* @file vw_b6.cpp
*
* @date Dec 26, 2019
2020-01-07 21:02:40 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2019-12-26 18:33:12 -08:00
*/
#include "engine.h"
#include "vw_b6.h"
2020-10-12 21:35:04 -07:00
#include "custom_engine.h"
2020-10-21 21:57:11 -07:00
#include "table_helper.h"
2019-12-26 18:33:12 -08:00
EXTERN_CONFIG;
/**
* set engine_type 62
2020-08-29 07:06:28 -07:00
* VW_B6
2020-10-12 21:35:04 -07:00
* has to be microRusEFI 0.5.2
2019-12-26 18:33:12 -08:00
*/
2020-08-29 07:06:28 -07:00
void setVwPassatB6(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
engineConfiguration->vvtMode = VVT_BOSCH_QUICK_START;
2019-12-26 18:33:12 -08:00
2020-08-29 16:01:44 -07:00
strcpy(CONFIG(engineMake), ENGINE_MAKE_VAG);
strcpy(CONFIG(engineCode), "BPY");
2020-08-29 14:05:54 -07:00
engineConfiguration->verboseVVTDecoding = true;
2020-08-29 16:01:44 -07:00
engineConfiguration->invertCamVVTSignal = true;
engineConfiguration->vvtCamSensorUseRise = true;
2020-10-12 21:35:04 -07:00
2020-10-17 11:53:56 -07:00
// EFI_ADC_7: "31 - AN volt 3" - PA7
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_7;
2020-10-12 21:35:04 -07:00
2020-10-17 11:53:56 -07:00
// "26 - AN volt 2"
engineConfiguration->high_fuel_pressure_sensor_1 = EFI_ADC_6;
// "19 - AN volt 4"
engineConfiguration->low_fuel_pressure_sensor = EFI_ADC_12;
2020-10-12 21:35:04 -07:00
CONFIG(isSdCardEnabled) = false;
CONFIG(mc33816spiDevice) = SPI_DEVICE_3;
setBoschHDEV_5_injectors(PASS_CONFIG_PARAMETER_SIGNATURE);
2020-10-17 17:17:53 -07:00
// RED
2020-10-12 21:35:04 -07:00
engineConfiguration->spi3mosiPin = GPIOC_12;
2020-10-17 17:17:53 -07:00
// YELLOW
2020-10-12 21:35:04 -07:00
engineConfiguration->spi3misoPin = GPIOC_11;
2020-10-17 17:17:53 -07:00
// BROWN
2020-10-12 21:35:04 -07:00
engineConfiguration->spi3sckPin = GPIOC_10;
engineConfiguration->sdCardCsPin = GPIO_UNASSIGNED;
CONFIG(is_enabled_spi_3) = true;
2020-10-17 17:17:53 -07:00
// J8 orange
CONFIG(mc33816_cs) = GPIOB_8;
// J8 Grey
CONFIG(mc33816_rstb) = GPIOA_15;
// J8 Dark BLUE
CONFIG(mc33816_driven) = GPIOB_9;
// J9 violet
CONFIG(mc33816_flag0) = GPIOC_13;
2020-10-12 21:35:04 -07:00
2020-10-17 17:17:53 -07:00
// J10 Dark BLUE
2020-10-12 21:35:04 -07:00
engineConfiguration->injectionPins[0] = GPIOE_6;
2020-10-17 17:17:53 -07:00
// J11 green
2020-10-12 21:35:04 -07:00
engineConfiguration->injectionPins[1] = GPIOE_5;
2020-10-17 17:17:53 -07:00
// J18 grey
engineConfiguration->injectionPins[2] = GPIOB_7;
// J6 white
engineConfiguration->injectionPins[3] = GPIOE_0;
2020-10-19 20:25:23 -07:00
engineConfiguration->gppwm[0].pwmFrequency = 25;
engineConfiguration->gppwm[0].loadAxis = GPPWM_FuelLoad;
// for now I just want to stop radiator whine
// todo: enable cooling!
engineConfiguration->gppwm[0].dutyIfError = 10;
2020-10-21 21:57:11 -07:00
setTable(engineConfiguration->gppwm[0].table, (uint8_t)10);
2020-10-19 20:25:23 -07:00
for (int load = 0; load < GPPWM_LOAD_COUNT; load++) {
for (int r = 0; r < GPPWM_RPM_COUNT; r++) {
engineConfiguration->gppwm[0].table[load][r] = 10;
}
}
engineConfiguration->gppwm[0].pin = GPIOE_10; // "3 - Lowside 2"
engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
engineConfiguration->fanPin = GPIO_UNASSIGNED;
2020-10-21 21:57:11 -07:00
CONFIG(useETBforIdleControl) = true;
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
2020-08-29 07:06:28 -07:00
}