diff --git a/firmware/config/boards/s105/board_configuration.cpp b/firmware/config/boards/s105/board_configuration.cpp index 39dcc2cade..8de1e2cd2c 100644 --- a/firmware/config/boards/s105/board_configuration.cpp +++ b/firmware/config/boards/s105/board_configuration.cpp @@ -4,15 +4,83 @@ * @brief Board-specific configuration defaults. * @todo Add your board-specific code, if any. */ + +static void setInjectorPins() { + engineConfiguration->injectionPins[0] = Gpio::D8; + engineConfiguration->injectionPins[1] = Gpio::D9; + engineConfiguration->injectionPins[2] = Gpio::D10; + engineConfiguration->injectionPins[3] = Gpio::D11; + + // Disable remainder + for (int i = 4; i < MAX_CYLINDER_COUNT;i++) { + engineConfiguration->injectionPins[i] = Gpio::Unassigned; + } + + engineConfiguration->injectionPinMode = OM_OPENDRAIN; +} + +static void setIgnitionPins() { + engineConfiguration->ignitionPins[0] = Gpio::D13; + engineConfiguration->ignitionPins[1] = Gpio::D12; + engineConfiguration->ignitionPins[2] = Gpio::D15; + engineConfiguration->ignitionPins[3] = Gpio::D14; + + // Disable remainder + for (int i = 4; i < MAX_CYLINDER_COUNT; i++) { + engineConfiguration->ignitionPins[i] = Gpio::Unassigned; + } + + engineConfiguration->ignitionPinMode = OM_OPENDRAIN; +} + void setBoardDefaultConfiguration() { - /* No LEDs on this board */ - engineConfiguration->communicationLedPin = Gpio::Unassigned; - engineConfiguration->runningLedPin = Gpio::Unassigned; - engineConfiguration->warningLedPin = Gpio::Unassigned; + setInjectorPins(); + setIgnitionPins(); + + // No LEDs on this board + engineConfiguration->communicationLedPin = Gpio::Unassigned; + engineConfiguration->runningLedPin = Gpio::Unassigned; + engineConfiguration->warningLedPin = Gpio::Unassigned; + + engineConfiguration->malfunctionIndicatorPin = Gpio::E14; + engineConfiguration->tachOutputPin = Gpio::B8; /* not populated by default */ + //engineConfiguration->idle.solenoidPin = ? + engineConfiguration->fanPin = Gpio::D6; /* not populated by default */ + //engineConfiguration->mainRelayPin = ?; + + engineConfiguration->specs.cylindersCount = 4; + engineConfiguration->specs.firingOrder = FO_1_2_4_3; + + engineConfiguration->ignitionMode = IM_WASTED_SPARK; + engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; + engineConfiguration->injectionMode = IM_SEQUENTIAL; +} + +static void setupVbatt() { + // There are two different input dividers: + // 22K (high) + 22K (low) on IAT and CLT + // 22K (high) + 41.2K (low) on TPS and MAP + engineConfiguration->analogInputDividerCoefficient = (22.0 + 22.0) / 22.0; + // TODO: TPS and MAP + //engineConfiguration->analogInputDividerCoefficient = (22.0 + 41.2) / 22.0; + + // 68K + 6.8k + engineConfiguration->vbattDividerCoeff = (68 + 6.8) / 6.8; + + // pin input +12 from Main Relay + engineConfiguration->vbattAdcChannel = EFI_ADC_9; + + engineConfiguration->adcVcc = 3.3f; } void setBoardConfigOverrides() { - //CAN 1 bus overwrites - engineConfiguration->canRxPin = Gpio::A11; - engineConfiguration->canTxPin = Gpio::A12; + setupVbatt(); + + //1.5K + engineConfiguration->clt.config.bias_resistor = 1500; + engineConfiguration->iat.config.bias_resistor = 1500; + + //CAN 1 bus overwrites + engineConfiguration->canRxPin = Gpio::A11; + engineConfiguration->canTxPin = Gpio::A12; } diff --git a/firmware/config/boards/s105/connectors/s105.yaml b/firmware/config/boards/s105/connectors/s105.yaml index 5be87e38ef..4aa2d481cb 100644 --- a/firmware/config/boards/s105/connectors/s105.yaml +++ b/firmware/config/boards/s105/connectors/s105.yaml @@ -34,14 +34,14 @@ pins: # 6-24 segment - pin: 6a id: D9 - function: Injector #2 + function: Injector 2 class: outputs ts_name: 6 - INJ_2 type: ls - pin: 7a id: D10 - function: Injector #3 + function: Injector 3 class: outputs ts_name: 7 - INJ_3 type: ls @@ -79,14 +79,14 @@ pins: # 25-43 segment - pin: 25a id: D0 - function: Injector #7 + function: Injector 7 class: outputs ts_name: na 25 - INJ_7 type: ls - pin: 27a id: D8 - function: Injector #1 + function: Injector 1 class: outputs ts_name: 27 - INJ_1 type: ls @@ -150,7 +150,7 @@ pins: - pin: 47a id: D11 - function: Injector #4 + function: Injector 4 class: outputs ts_name: 47 - INJ_4 type: ls @@ -164,7 +164,7 @@ pins: - pin: 49a id: E6 - function: Injector #6 + function: Injector 6 class: outputs ts_name: na 49 - INJ_6 type: ls @@ -210,9 +210,9 @@ pins: - pin: 68a id: D6 - function: Fan Relay #1 + function: Fan Relay 1 class: outputs - ts_name: na 58 - Fan Relay #1 + ts_name: na 58 - Fan Relay 1 type: ls - pin: 69a