rusefi/firmware/config/boards/hellen/hellen-112-17/board_configuration.cpp

157 lines
4.5 KiB
C++
Raw Normal View History

2023-09-09 16:40:18 -07:00
/**
2023-09-10 08:52:50 -07:00
* @file boards/hellen/hellen-112-17/board_configuration.cpp
2023-09-09 16:40:18 -07:00
*
* See https://rusefi.com/s/XX
*
* @author Andrey Belomutskiy, (c) 2012-2023
*/
#include "pch.h"
#include "defaults.h"
#include "hellen_meta.h"
static void setInjectorPins() {
2023-09-10 08:52:50 -07:00
engineConfiguration->injectionPins[0] = Gpio::MM100_INJ1;
engineConfiguration->injectionPins[1] = Gpio::MM100_INJ2;
engineConfiguration->injectionPins[2] = Gpio::MM100_INJ3;
engineConfiguration->injectionPins[3] = Gpio::MM100_INJ4;
2023-09-09 16:40:18 -07:00
}
static void setIgnitionPins() {
2023-09-10 08:52:50 -07:00
engineConfiguration->ignitionPins[0] = Gpio::MM100_IGN1;
engineConfiguration->ignitionPins[1] = Gpio::MM100_IGN2;
engineConfiguration->ignitionPins[2] = Gpio::MM100_IGN3;
engineConfiguration->ignitionPins[3] = Gpio::MM100_IGN4;
2023-09-09 16:40:18 -07:00
}
static void setupDefaultSensorInputs() {
2023-10-14 17:54:02 -07:00
engineConfiguration->vehicleSpeedSensorInputPin = Gpio::MM100_IN_D2;
2023-09-09 16:40:18 -07:00
2023-09-10 08:52:50 -07:00
engineConfiguration->tps1_1AdcChannel = MM100_IN_TPS_ANALOG;
2023-10-14 17:54:02 -07:00
engineConfiguration->tps1_2AdcChannel = MM100_IN_O2S_ANALOG;
setPPSInputs(MM100_IN_PPS_ANALOG, MM100_IN_AUX2_ANALOG);
2023-09-09 16:40:18 -07:00
2023-12-03 09:46:58 -08:00
engineConfiguration->map.sensor.hwChannel = H144_IN_MAP1;
2023-09-09 16:40:18 -07:00
2023-09-10 08:52:50 -07:00
engineConfiguration->clt.adcChannel = MM100_IN_CLT_ANALOG;
2023-09-09 16:40:18 -07:00
2023-09-10 08:52:50 -07:00
engineConfiguration->iat.adcChannel = MM100_IN_IAT_ANALOG;
2023-09-09 16:40:18 -07:00
}
2023-09-10 08:52:50 -07:00
#include "hellen_leds_100.cpp"
2023-09-09 16:40:18 -07:00
void setBoardConfigOverrides() {
2023-09-17 10:53:26 -07:00
// rev A needs EN pin but newer revisions would potentially not use it
2023-09-09 16:40:18 -07:00
setHellenMegaEnPin();
2023-12-02 10:43:21 -08:00
setHellenVbatt();
2023-09-09 16:40:18 -07:00
hellenMegaSdWithAccelerometer();
2023-09-09 16:40:18 -07:00
configureHellenCanTerminator();
2023-09-17 10:53:26 -07:00
setHellenCan();
2023-09-09 16:40:18 -07:00
2023-12-28 19:38:09 -08:00
setDefaultHellenAtPullUps();
2023-09-09 16:40:18 -07:00
2023-10-14 17:54:02 -07:00
engineConfiguration->triggerInputPins[0] = Gpio::MM100_IN_CRANK;
engineConfiguration->camInputs[0] = Gpio::MM100_IN_D1;
2023-09-09 16:40:18 -07:00
2023-09-17 15:38:51 -07:00
//ETB1
// PWM pin
engineConfiguration->etbIo[0].controlPin = Gpio::MM100_OUT_PWM6;
// DIR pin
engineConfiguration->etbIo[0].directionPin1 = Gpio::MM100_SPI2_MISO;
// Disable pin
engineConfiguration->etbIo[0].disablePin = Gpio::MM100_SPI2_MOSI;
2023-09-09 16:40:18 -07:00
}
/**
* @brief Board-specific configuration defaults.
*
* See also setDefaultEngineConfiguration
*
2023-12-16 19:36:23 -08:00
2023-09-09 16:40:18 -07:00
*/
void setBoardDefaultConfiguration() {
setInjectorPins();
setIgnitionPins();
2023-09-10 08:52:50 -07:00
// not override since sometimes we have issues?
// setHellenMMbaro();
2023-09-09 16:40:18 -07:00
engineConfiguration->displayLogicLevelsInEngineSniffer = true;
2023-09-10 08:52:50 -07:00
engineConfiguration->globalTriggerAngleOffset = 0;
2023-09-09 16:40:18 -07:00
engineConfiguration->enableSoftwareKnock = true;
2023-09-10 08:52:50 -07:00
engineConfiguration->canTxPin = Gpio::MM100_CAN_TX;
engineConfiguration->canRxPin = Gpio::MM100_CAN_RX;
2023-09-09 16:40:18 -07:00
2023-10-14 17:54:02 -07:00
engineConfiguration->fuelPumpPin = Gpio::MM100_OUT_PWM5;
2023-09-10 08:52:50 -07:00
// engineConfiguration->idle.solenoidPin = Gpio::H144_LS_6;
// engineConfiguration->fanPin = Gpio::H144_OUT_IO12;
2023-09-17 15:38:51 -07:00
engineConfiguration->mainRelayPin = Gpio::MM100_IGN8;
2023-09-10 08:52:50 -07:00
// engineConfiguration->malfunctionIndicatorPin = Gpio::H144_OUT_IO7;
2023-09-09 16:40:18 -07:00
// how come this is not denso 183?!
2023-11-07 22:15:33 -08:00
setCustomMap(/*lowValue*/ 11.4, /*mapLowValueVoltage*/ 0.5, /*highValue*/ 170.7, 4.8);
2023-09-09 16:40:18 -07:00
2023-09-10 08:52:50 -07:00
// engineConfiguration->brakePedalPin = Gpio::H144_IN_CAM;
// engineConfiguration->acRelayPin = Gpio::H144_LS_5;
// engineConfiguration->tachOutputPin = Gpio::H144_OUT_IO10;
2023-09-09 16:40:18 -07:00
// A/C switch on k-line
// "required" hardware is done - set some reasonable defaults
setupDefaultSensorInputs();
2023-09-10 08:52:50 -07:00
engineConfiguration->etbFunctions[0] = DC_Throttle1;
2023-09-09 16:40:18 -07:00
// Some sensible defaults for other options
setCrankOperationMode();
setAlgorithm(LM_SPEED_DENSITY);
engineConfiguration->injectorCompensationMode = ICM_FixedRailPressure;
setCommonNTCSensor(&engineConfiguration->clt, HELLEN_DEFAULT_AT_PULLUP);
setCommonNTCSensor(&engineConfiguration->iat, HELLEN_DEFAULT_AT_PULLUP);
setTPS1Calibration(100, 650);
2023-09-10 08:52:50 -07:00
//hellenWbo();
2023-09-09 16:40:18 -07:00
}
2023-09-17 19:42:39 -07:00
static Gpio OUTPUTS[] = {
2023-10-12 16:55:43 -07:00
Gpio::MM100_INJ1, // 244 injector output 1
Gpio::MM100_INJ2, // 242 injector output 2
Gpio::MM100_INJ3, // 243 injector output 3
Gpio::MM100_INJ4, // 245 injector output 4
Gpio::MM100_IGN1, // 256 Coil 1
Gpio::MM100_IGN2, // 253 Coil 2
Gpio::MM100_IGN3, // 254 Coil 3
Gpio::MM100_IGN4, // 255 Coil 4
Gpio::MM100_INJ6, // 9 235 Low Side Output
2023-10-12 16:55:43 -07:00
Gpio::MM100_INJ5, // 101 low side 1.5A output
Gpio::MM100_INJ7, // 102 low side 1.5A output
2023-10-15 09:41:02 -07:00
Gpio::MM100_IGN8, // 12 115 Main Relay
2023-10-12 16:55:43 -07:00
Gpio::MM100_OUT_PWM3, // 131 Relay Output
Gpio::MM100_IGN7, // 140 Relay Output
2023-10-12 17:06:10 -07:00
Gpio::MM100_OUT_PWM4, // 141 Engine Radiator Fan
2023-10-12 16:55:43 -07:00
Gpio::MM100_OUT_PWM5, // 142 Fuel Pump Relay
Gpio::MM100_IGN5, // 151 relay output
2023-10-15 09:41:02 -07:00
Gpio::MM100_IGN6, // 18 152 relay output
2023-10-15 10:33:45 -07:00
Gpio::MM100_INJ8, // 246 low side 1.5A output
2023-09-17 19:42:39 -07:00
};
int getBoardMetaOutputsCount() {
return efi::size(OUTPUTS);
}
Gpio* getBoardMetaOutputs() {
return OUTPUTS;
}
int getBoardMetaDcOutputsCount() {
return 1;
}