114 lines
4.1 KiB
C++
114 lines
4.1 KiB
C++
#include "pch.h"
|
|
#include "gm_sbc.h"
|
|
#include "defaults.h"
|
|
|
|
#if HW_HELLEN
|
|
#include "hellen_meta.h"
|
|
#endif // HW_HELLEN
|
|
|
|
#include "proteus_meta.h"
|
|
|
|
void setStepperHw() {
|
|
engineConfiguration->useStepperIdle = true;
|
|
engineConfiguration->useHbridgesToDriveIdleStepper = true;
|
|
engineConfiguration->stepper_dc_use_two_wires = false;
|
|
engineConfiguration->stepperDcInvertedPins = false; // or true?
|
|
|
|
// for instance IWP069
|
|
engineConfiguration->injector.flow = 482.5;
|
|
|
|
#if HW_HELLEN
|
|
setPPSInputs(EFI_ADC_NONE, EFI_ADC_NONE);
|
|
// using 8chan pinout for DC1: A26 (OUT_DC1+ AH pin "D") and A27 (OUT_DC1- AL pin "C")
|
|
engineConfiguration->stepperDcIo[0].controlPin = H144_GP4; // DC1_PWM
|
|
engineConfiguration->stepperDcIo[0].directionPin1 = Gpio::H144_GP3; // DC1_DIR
|
|
engineConfiguration->stepperDcIo[0].directionPin2 = Gpio::Unassigned;
|
|
engineConfiguration->stepperDcIo[0].disablePin = H144_GP5; // ETB_DIS
|
|
// using 8chan pinout for DC2: A28 (OUT_DC2+ BL pin "A") and A29 (OUT_DC2- BH pin "B")
|
|
engineConfiguration->stepperDcIo[1].controlPin = H144_UART1_TX; // DC2_PWM
|
|
engineConfiguration->stepperDcIo[1].directionPin1 = H_SPI3_CS; // DC2_DIR
|
|
engineConfiguration->stepperDcIo[1].directionPin2 = Gpio::Unassigned;
|
|
// open question if we need custom logic to handle shared disable pin? engineConfiguration->stepperDcIo[1].disablePin = H144_GP5; // ETB_DIS
|
|
#endif // HW_HELLEN
|
|
|
|
#if HW_PROTEUS
|
|
// coil #1 - proteus pin 7 to AH pin "D"
|
|
// PWM pin
|
|
engineConfiguration->stepperDcIo[0].controlPin = Gpio::D12;
|
|
// DIR pin
|
|
engineConfiguration->stepperDcIo[0].directionPin1 = Gpio::D10;
|
|
// Disable pin
|
|
engineConfiguration->stepperDcIo[0].disablePin = Gpio::D11;
|
|
// Unused
|
|
engineConfiguration->stepperDcIo[0].directionPin2 = Gpio::Unassigned;
|
|
|
|
// coil #2 = proteus pin 15 to BL pin "A"
|
|
// PWM pin
|
|
engineConfiguration->stepperDcIo[1].controlPin = Gpio::D13;
|
|
// DIR pin
|
|
engineConfiguration->stepperDcIo[1].directionPin1 = Gpio::D9;
|
|
// Disable pin
|
|
engineConfiguration->stepperDcIo[1].disablePin = Gpio::D8;
|
|
// Unused
|
|
engineConfiguration->stepperDcIo[1].directionPin2 = Gpio::Unassigned;
|
|
#endif // HW_PROTEUS
|
|
}
|
|
|
|
void setSbc() {
|
|
engineConfiguration->cylindersCount = 8;
|
|
engineConfiguration->firingOrder = FO_1_8_4_3_6_5_7_2;
|
|
engineConfiguration->displacement = 5.2;
|
|
|
|
// see engine sniffer at https://github.com/rusefi/rusefi/issues/5353
|
|
// if injectors are wired in groups of four best to use channels 1 and 4
|
|
engineConfiguration->crankingInjectionMode = IM_BATCH;
|
|
engineConfiguration->injectionMode = IM_BATCH;
|
|
|
|
engineConfiguration->etbFunctions[0] = DC_None;
|
|
engineConfiguration->etbFunctions[1] = DC_None;
|
|
|
|
strcpy(engineConfiguration->engineMake, ENGINE_MAKE_GM);
|
|
strcpy(engineConfiguration->engineCode, "SBC");
|
|
// white wire "HEI E" plug pin D
|
|
engineConfiguration->ignitionMode = IM_ONE_COIL;
|
|
engineConfiguration->globalTriggerAngleOffset = 24;
|
|
|
|
gppwm_channel *ignOverride = &engineConfiguration->gppwm[0];
|
|
ignOverride->pwmFrequency = 0;
|
|
strcpy(engineConfiguration->gpPwmNote[0], "ign ovrrd B");
|
|
setTable(ignOverride->table, 100);
|
|
|
|
#if HW_PROTEUS
|
|
// tan wire with a black trace - "HEI B", plug pin B
|
|
ignOverride->pin = Gpio::PROTEUS_IGN_12;
|
|
engineConfiguration->fanPin = Gpio::Unassigned;
|
|
// reminder about D101
|
|
engineConfiguration->injectionPins[0] = Gpio::PROTEUS_LS_14; // #1
|
|
// reminder about D104
|
|
engineConfiguration->injectionPins[3] = Gpio::PROTEUS_LS_15; // #4
|
|
|
|
// wow high side relay control
|
|
engineConfiguration->fuelPumpPin = Gpio::PROTEUS_HS_1;
|
|
setGmCltSensor(&engineConfiguration->clt, PROTEUS_DEFAULT_AT_PULLUP);
|
|
#endif // HW_PROTEUS
|
|
engineConfiguration->mainRelayPin = Gpio::Unassigned; // vehicle controls main relay
|
|
|
|
setStepperHw();
|
|
|
|
// 8 cylinders one coil HEI trigger
|
|
engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL;
|
|
engineConfiguration->trigger.customTotalToothCount = 8;
|
|
engineConfiguration->trigger.customSkippedToothCount = 0;
|
|
engineConfiguration->skippedWheelOnCam = true;
|
|
// Proteus Digital 1 is Tach input "HEI R", plug pin C
|
|
|
|
engineConfiguration->map.sensor.type = MT_GM_1_BAR;
|
|
}
|
|
|
|
void set8chanSbc() {
|
|
setSbc();
|
|
}
|
|
|
|
void setProteusSbc() {
|
|
setSbc();
|
|
} |