rusEFI
The most advanced open source ECU
Functions | Variables
custom_engine.cpp File Reference

Detailed Description

set engine_type 49 FRANKENSO_QA_ENGINE See also DEFAULT_ENGINE_TYPE Frankenso QA 12 cylinder engine

Date
Jan 18, 2015
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file custom_engine.cpp.

Functions

void setDiscoveryPdm ()
 
void setDiscoveryTLE9104Test ()
 
void setDiscovery33810Test ()
 
void setFrankensoConfiguration ()
 
void setFrankensoBoardTestConfiguration ()
 
void setEtbTestConfiguration ()
 
void setEepromTestConfiguration ()
 
void setL9779TestConfiguration ()
 
void proteusDcWastegateTest ()
 
void proteusBoardTest ()
 
static void setBasicNotECUmode ()
 
void setBodyControlUnit ()
 
void mreSecondaryCan ()
 
void mreBCM ()
 
void mreBoardNewTest ()
 
void setBoschHDEV_5_injectors ()
 
void setRotary ()
 
void setTest33816EngineConfiguration ()
 
void proteusLuaDemo ()
 
void detectBoardType ()
 
void fuelBenchMode ()
 
void proteusStimQc ()
 
void alphax4chanStimQc ()
 
void testEngine6451 ()
 

Variables

static uint8_t write_buf [EE_PAGE_SIZE+10]
 
static const I2CEepromFileConfig i2cee
 
EepromDevice eepdev_24xx
 
static I2CEepromFileStream ifile
 
static const float hardCodedHpfpLobeProfileQuantityBins [16]
 
static const float hardCodedHpfpLobeProfileAngle [16]
 

Function Documentation

◆ alphax4chanStimQc()

void alphax4chanStimQc ( )

Definition at line 940 of file custom_engine.cpp.

940  {
942  engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
943  engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
944 
945  engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CAM; // C7
946  engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_D_4; // E6
947  engineConfiguration->camInputs[0] = Gpio::H144_IN_VSS; // C4
948  engineConfiguration->camInputs[1] = Gpio::H144_IN_D_AUX4; // E7
949  engineConfiguration->camInputs[2] = Gpio::H144_IN_SENS2; // E3
950  engineConfiguration->camInputs[3] = Gpio::H144_IN_SENS3; // E4
951 }
engine_configuration_s * engineConfiguration
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]

Referenced by resetConfigurationExt().

Here is the caller graph for this function:

◆ detectBoardType()

void detectBoardType ( )

Definition at line 877 of file custom_engine.cpp.

877  {
878 #if HW_HELLEN && EFI_PROD_CODE
880 #endif //HW_HELLEN EFI_PROD_CODE
881  // todo: add board ID detection?
882  // see hellen128 which has/had alternative i2c board id?
883 }
void detectHellenBoardType()

Referenced by runRusEfi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fuelBenchMode()

void fuelBenchMode ( )

Definition at line 885 of file custom_engine.cpp.

885  {
887 #if EFI_ENGINE_CONTROL
889 #endif // EFI_ENGINE_CONTROL
894 }
static void setBasicNotECUmode()
void setFlatInjectorLag(float value)
persistent_config_s * config
float postCrankingFactor[CRANKING_ENRICH_COUNT][CRANKING_ENRICH_COUNT]
float crankingCycleFuelCoef[CRANKING_CYCLE_CLT_SIZE][CRANKING_CURVE_SIZE]
constexpr void setTable(TElement(&dest)[N][M], const VElement value)
Definition: table_helper.h:158
void setArrayValues(TValue(&array)[TSize], float value)
Definition: table_helper.h:151

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mreBCM()

void mreBCM ( )

Definition at line 521 of file custom_engine.cpp.

521  {
522  mreSecondaryCan();
523  // maybe time to kill this feature is pretty soon?
525 }
void mreSecondaryCan()

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mreBoardNewTest()

void mreBoardNewTest ( )

MRE_BOARD_NEW_TEST set engine_type 31

Definition at line 531 of file custom_engine.cpp.

531  {
532 #if (BOARD_TLE8888_COUNT > 0)
533  engineConfiguration->debugMode = DBG_TLE8888;
534 
536  // set cranking_rpm 500
538  // set cranking_dwell 200
540  // set cranking_fuel 300
542  engineConfiguration->injectionMode = IM_SEQUENTIAL;
544 
545  // EFI_ADC_1: "23 - AN temp 2"
546  // test harness: Red/Green, 2K PD. expected 2.0v
547  // iat in microrusefi/board_configuration.cpp
548 
549  // EFI_ADC_2: "24 - AN temp 3"
550  // test harness: Blue/White, 2K PD. expected 2.0v
551 
552 
553  // EFI_ADC_10: "27 - AN volt 1"
554  // test harness: Blue/Red, 3.84K PD / 5.3 PU. expected 1.6v
555  engineConfiguration->mafAdcChannel = EFI_ADC_10;
556 
557  // EFI_ADC_14: "32 - AN volt 6"
558  // test harness: Red/White 3.6K PD / 5.2 PU. expected 1.6v
560 
561  // EFI_ADC_4: "28 - AN volt 10"
562  // test harness: Red/Yellow
563  engineConfiguration->afr.hwChannel = EFI_ADC_4;
564 
565  // EFI_ADC_7: "31 - AN volt 3"
566  // test harness: White/Red
568 
572 
573 
574 #endif /* BOARD_TLE8888_COUNT */
575 
577  engineConfiguration->firingOrder = FO_1_2_3_4_5_6_7_8_9_10_11_12;
578  engineConfiguration->injector.flow = 5; // longer blink
579 
580 
581 #if (BOARD_TLE8888_COUNT > 0)
588 
591 
592  // LED #8
593  // TLE8888 half bridges (pushpull, lowside, or high-low) IN12
594  // Gpio::TLE8888_PIN_21: "35 - GP Out 1"
596 
597  // LED #1
598  // Gpio::TLE8888_PIN_22: "34 - GP Out 2"
600 
601  // LED #2
602  // Gpio::TLE8888_PIN_23: "33 - GP Out 3"
603  engineConfiguration->ignitionPins[11 - 1] = MRE_GPOUT_3;
604 
605  // LED #7
606  // Gpio::TLE8888_PIN_24: "43 - GP Out 4"
608 
609  engineConfiguration->afr.hwChannel = EFI_ADC_6;
611 
612  // TLE8888 high current low side: IN10
613  // Gpio::TLE8888_PIN_6: "7 - Lowside 1"
615 
616  // TLE8888 high current low side: VVT2 IN9 / OUT5
617  // Gpio::TLE8888_PIN_5: "3 - Lowside 2"
619 
620  // Gpio::TLE8888_PIN_4: INJ#4
622  // Gpio::TLE8888_PIN_3: INJ#3
624  // Gpio::TLE8888_PIN_2: INJ#2
626  // Gpio::TLE8888_PIN_1: LED #3 - INJ#1
628 
629 
630  engineConfiguration->injectionPins[7 - 1] = Gpio::A4; // AV10
631  engineConfiguration->injectionPins[8 - 1] = Gpio::B1; // AV9
632  engineConfiguration->injectionPins[9 - 1] = Gpio::B0; // AV8
633  engineConfiguration->injectionPins[10 - 1] = Gpio::C4; // AV6
634 
636 
638 #endif /* BOARD_TLE8888_COUNT */
639 
640 }
@ TLE8888_PIN_12
@ Unassigned
@ TLE8888_PIN_22
@ TLE8888_PIN_1
@ TLE8888_PIN_11
@ TLE8888_PIN_2
@ TLE8888_PIN_5
@ TLE8888_PIN_6
@ TLE8888_PIN_24
@ TLE8888_PIN_4
@ TLE8888_PIN_21
@ TLE8888_PIN_3
@ TLE8888_PIN_13
@ TLE8888_PIN_10

Referenced by resetConfigurationExt().

Here is the caller graph for this function:

◆ mreSecondaryCan()

void mreSecondaryCan ( )

Definition at line 484 of file custom_engine.cpp.

484  {
486 
487  engineConfiguration->auxAnalogInputs[0] = MRE_IN_TPS;
488  engineConfiguration->auxAnalogInputs[1] = MRE_IN_MAP;
489  engineConfiguration->auxAnalogInputs[2] = MRE_IN_CLT;
490  engineConfiguration->auxAnalogInputs[3] = MRE_IN_IAT;
491  // engineConfiguration->auxAnalogInputs[0] =
492 
493 
494  // EFI_ADC_14: "32 - AN volt 6"
495 // engineConfiguration->afr.hwChannel = EFI_ADC_14;
496 
497 
498  strncpy(config->luaScript, R"(
499 txPayload = {}
500 function onTick()
501  auxV = getAuxAnalog(0)
502  print('Hello analog ' .. auxV )
503  -- first byte: integer part, would be autoboxed to int
504  txPayload[1] = auxV
505  -- second byte: fractional part, would be autoboxed to int, overflow would be ignored
506  txPayload[2] = auxV * 256;
507  auxV = getAuxAnalog(1)
508  print('Hello analog ' .. auxV )
509  txPayload[3] = auxV
510  txPayload[4] = auxV * 256;
511  auxV = getAuxAnalog(2)
512  print('Hello analog ' .. auxV )
513  txPayload[5] = auxV
514  txPayload[6] = auxV * 256;
515  txCan(1, 0x600, 1, txPayload)
516 end
517 )", efi::size(config->luaScript));
518 
519 }
void setBodyControlUnit()
composite packet size

Referenced by mreBCM(), and resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proteusBoardTest()

void proteusBoardTest ( )

PROTEUS_QC_TEST_BOARD set engine_type 42

Definition at line 386 of file custom_engine.cpp.

386  {
388  engineConfiguration->firingOrder = FO_1_2_3_4_5_6_7_8_9_10_11_12;
390  engineConfiguration->injector.flow = 4.6; // longer blink
391 
393  engineConfiguration->injectionMode = IM_SEQUENTIAL;
395 
399 
400 #if EFI_PROD_CODE
401  engineConfiguration->injectionPins[0] = Gpio::PROTEUS_LS_1;
402  engineConfiguration->injectionPins[1] = Gpio::PROTEUS_LS_2;
403  engineConfiguration->injectionPins[2] = Gpio::PROTEUS_LS_3;
404  engineConfiguration->injectionPins[3] = Gpio::PROTEUS_LS_4;
405  engineConfiguration->injectionPins[4] = Gpio::PROTEUS_LS_5;
406  engineConfiguration->injectionPins[5] = Gpio::PROTEUS_LS_6;
407  engineConfiguration->injectionPins[6] = Gpio::PROTEUS_LS_9;
408  engineConfiguration->injectionPins[7] = Gpio::PROTEUS_LS_8;
409  engineConfiguration->injectionPins[8] = Gpio::PROTEUS_LS_11;
410  engineConfiguration->injectionPins[9] = Gpio::PROTEUS_LS_10;
411  engineConfiguration->injectionPins[10] = Gpio::PROTEUS_LS_12;
412  engineConfiguration->injectionPins[11] = Gpio::PROTEUS_LS_13;
413 
414 
415  engineConfiguration->luaOutputPins[0] = Gpio::PROTEUS_LS_7;
416  engineConfiguration->luaOutputPins[1] = Gpio::PROTEUS_LS_14;
417  engineConfiguration->luaOutputPins[2] = Gpio::PROTEUS_LS_15;
418  engineConfiguration->luaOutputPins[3] = Gpio::PROTEUS_LS_16;
419  engineConfiguration->luaOutputPins[4] = Gpio::PROTEUS_HS_2;
420  engineConfiguration->luaOutputPins[5] = Gpio::PROTEUS_HS_4;
421 
422  engineConfiguration->ignitionPins[0] = Gpio::PROTEUS_IGN_1;
423  engineConfiguration->ignitionPins[1] = Gpio::PROTEUS_IGN_2;
424  engineConfiguration->ignitionPins[2] = Gpio::PROTEUS_IGN_4;
425  engineConfiguration->ignitionPins[3] = Gpio::PROTEUS_IGN_5;
426  engineConfiguration->ignitionPins[4] = Gpio::PROTEUS_IGN_6;
427  engineConfiguration->ignitionPins[5] = Gpio::PROTEUS_IGN_7;
428 
429  engineConfiguration->ignitionPins[6] = Gpio::PROTEUS_HS_3;
430  engineConfiguration->ignitionPins[7] = Gpio::PROTEUS_IGN_3;
431  engineConfiguration->ignitionPins[8] = Gpio::PROTEUS_IGN_9;
432  engineConfiguration->ignitionPins[9] = Gpio::PROTEUS_IGN_8;
433  engineConfiguration->ignitionPins[10] = Gpio::PROTEUS_HS_1;
434  engineConfiguration->ignitionPins[11] = Gpio::PROTEUS_IGN_12;
435 
436  strncpy(config->luaScript, R"(
437  startPwm(0, 10, 0.5)
438  startPwm(1, 11, 0.5)
439  startPwm(2, 12, 0.5)
440  startPwm(3, 13, 0.5)
441  startPwm(4, 14, 0.5)
442  startPwm(5, 15, 0.5)
443  startPwm(6, 16, 0.5)
444  startPwm(7, 17, 0.5)
445 
446  function onTick()
447  end
448  )", efi::size(config->luaScript));
449 
450 #endif // EFI_PROD_CODE
451 
452 #if EFI_ELECTRONIC_THROTTLE_BODY
454 #endif // EFI_ELECTRONIC_THROTTLE_BODY
455 }
void setProteusHitachiEtbDefaults()

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proteusDcWastegateTest()

void proteusDcWastegateTest ( )

Definition at line 355 of file custom_engine.cpp.

355  {
357  engineConfiguration->etbFunctions[0] = DC_Wastegate;
358  engineConfiguration->etbFunctions[1] = DC_None;
359  engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
360 
362  setTPS1Calibration(98, 926, 891, 69);
363 
367 
368  strncpy(config->luaScript, R"(
369 
370 mapSensor = Sensor.new("map")
371 mapSensor : setTimeout(3000)
372 
373 function onTick()
374  local tps = getSensor("TPS1")
375  tps = (tps == nil and 0 or tps)
376  mapSensor : set(tps)
377 end
378 
379  )", efi::size(config->luaScript));
380 }
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax)

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proteusLuaDemo()

void proteusLuaDemo ( )

for this demo I use ETB just a sample object to control with PID. No reasonable person should consider actually using Lua for actual intake ETB control while driving around the racing track - hard-coded ETB control is way smarter!

controlIndex = 0 directionIndex = 1

print('pid output ' .. output) print('')

local duty = (bias + output) / 100

– isPositive = duty > 0; – pwmValue = isPositive and duty or -duty – setPwmDuty(controlIndex, pwmValue)

– dirValue = isPositive and 1 or 0; – setPwmDuty(directionIndex, dirValue)

– print('pwm ' .. pwmValue .. ' dir ' .. dirValue)

Definition at line 754 of file custom_engine.cpp.

754  {
755 #if HW_PROTEUS
758 
761 
762  strcpy(engineConfiguration->scriptCurveName[2 - 1], "rateofchange");
763 
764  strcpy(engineConfiguration->scriptCurveName[3 - 1], "bias");
765 
766  /**
767  * for this demo I use ETB just a sample object to control with PID. No reasonable person should consider actually using
768  * Lua for actual intake ETB control while driving around the racing track - hard-coded ETB control is way smarter!
769  */
770  static const float defaultBiasBins[] = {
771  0, 1, 2, 4, 7, 98, 99, 100
772  };
773  static const float defaultBiasValues[] = {
774  -20, -18, -17, 0, 20, 21, 22, 25
775  };
776 
780 
781  setLinearCurve(config->scriptCurve2Bins, 0, 8000, 1);
782  setLinearCurve(config->scriptCurve2, 0, 100, 1);
783 
786 
787  engineConfiguration->auxAnalogInputs[0] = PROTEUS_IN_ANALOG_VOLT_10;
788  engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
789 
790 
791  // ETB direction #1 PD10
793  // ETB control PD12
795  // ETB disable PD11
797 
798 /**
799 controlIndex = 0
800 directionIndex = 1
801 
802  print('pid output ' .. output)
803  print('')
804 
805 
806 
807  local duty = (bias + output) / 100
808 
809 -- isPositive = duty > 0;
810 -- pwmValue = isPositive and duty or -duty
811 -- setPwmDuty(controlIndex, pwmValue)
812 
813 -- dirValue = isPositive and 1 or 0;
814 -- setPwmDuty(directionIndex, dirValue)
815 
816 -- print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
817 
818  *
819  */
820 
821  auto script = R"(
822 
823 startPwm(0, 800, 0.1)
824 -- direction
825 startPwm(1, 80, 1.0)
826 -- disable
827 startPwm(2, 80, 0.0)
828 
829 pid = Pid.new(2, 0, 0, -100, 100)
830 
831 biasCurveIndex = findCurveIndex("bias")
832 
833 voltageFromCan = nil
834 canRxAdd(0x600)
835 
836 function onCanRx(bus, id, dlc, data)
837  print('got CAN id=' .. id .. ' dlc=' .. dlc)
838  voltageFromCan = data[2] / 256.0 + data[1]
839 end
840 
841 function onTick()
842  local targetVoltage = getAuxAnalog(0)
843 
844 -- local target = interpolate(1, 0, 3.5, 100, targetVoltage)
845  local target = interpolate(1, 0, 3.5, 100, voltageFromCan)
846 -- clamp 0 to 100
847  target = math.max(0, target)
848  target = math.min(100, target)
849 
850  print('Decoded target: ' .. target)
851 
852  local tps = getSensor("TPS1")
853  tps = (tps == nil and 'invalid TPS' or tps)
854  print('Tps ' .. tps)
855 
856  local output = pid:get(target, tps)
857 
858  local bias = curve(biasCurveIndex, target)
859  print('bias ' .. bias)
860 
861  local duty = (bias + output) / 100
862  isPositive = duty > 0;
863  pwmValue = isPositive and duty or -duty
864  setPwmDuty(0, pwmValue)
865 
866  dirValue = isPositive and 1 or 0;
867  setPwmDuty(1, dirValue)
868 
869  print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
870  print('')
871 end
872  )";
873  strncpy(config->luaScript, script, efi::size(config->luaScript));
874 #endif
875 }
static const float defaultBiasValues[]
static const float defaultBiasBins[]
void setLinearCurve(TValue(&array)[TSize], float from, float to, float precision=0.01f)
Definition: table_helper.h:139

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proteusStimQc()

void proteusStimQc ( )

Definition at line 899 of file custom_engine.cpp.

899  {
901  engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
902  engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
903 
904  engineConfiguration->triggerInputPins[0] = PROTEUS_DIGITAL_1;
905  engineConfiguration->triggerInputPins[1] = PROTEUS_DIGITAL_2;
906  engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_3;
907  engineConfiguration->camInputs[1] = PROTEUS_DIGITAL_4;
908  engineConfiguration->vehicleSpeedSensorInputPin = PROTEUS_DIGITAL_5;
909  engineConfiguration->brakePedalPin = PROTEUS_DIGITAL_6;
910 
911  setProteusEtbIO();
912  // EFI_ADC_13: "Analog Volt 4"
913  engineConfiguration->tps2_1AdcChannel = PROTEUS_IN_TPS2_1;
914  // EFI_ADC_0: "Analog Volt 5"
915  engineConfiguration->tps2_2AdcChannel = PROTEUS_IN_ANALOG_VOLT_5;
916  engineConfiguration->oilPressure.hwChannel = PROTEUS_IN_ANALOG_VOLT_6;
917  // pps2 volt 7
918 
919  // pps1 volt 9
920  // afr volt 10
921  engineConfiguration->oilTempSensor.adcChannel = PROTEUS_IN_ANALOG_VOLT_11;
923 
924 
925  engineConfiguration->auxLinear1.hwChannel = PROTEUS_IN_ANALOG_TEMP_1;
926  engineConfiguration->auxLinear2.hwChannel = PROTEUS_IN_ANALOG_TEMP_4;
927 
928 // engineConfiguration->fan2Pin = Gpio::PROTEUS_LS_9;
929 // engineConfiguration->malfunctionIndicatorPin = Gpio::PROTEUS_LS_13;
930 // engineConfiguration->tachOutputPin = Gpio::PROTEUS_LS_14;
931 //
932 // engineConfiguration->vvtPins[0] = Gpio::PROTEUS_LS_15;
933 // engineConfiguration->vvtPins[1] = Gpio::PROTEUS_LS_16;
934 }
void setProteusEtbIO()
void setCommonNTCSensor(ThermistorConf *thermistorConf, float pullup)
Definition: thermistors.cpp:34

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBasicNotECUmode()

static void setBasicNotECUmode ( )
static

Definition at line 458 of file custom_engine.cpp.

Referenced by fuelBenchMode(), and setBodyControlUnit().

Here is the caller graph for this function:

◆ setBodyControlUnit()

void setBodyControlUnit ( )

Definition at line 476 of file custom_engine.cpp.

476  {
477  for (int i = 0; i < MAX_CYLINDER_COUNT;i++) {
480  }
482 }

Referenced by mreSecondaryCan(), and setHondaCivicBcm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBoschHDEV_5_injectors()

void setBoschHDEV_5_injectors ( )

Definition at line 653 of file custom_engine.cpp.

653  {
657 
660  setTable(config->hpfpTarget, 5000);
661 
663  setLinearCurve(config->hpfpCompensationLoadBins, 0.005, 0.120, 0.001);
664 
665  // This is the configuration for bosch HDEV 5 injectors
666  // all times in microseconds/us
678 
679  engineConfiguration->mc33_hpfp_i_peak = 5; // A not mA like above
682  engineConfiguration->mc33_hpfp_max_hold = 10; // this value in ms not us
683 }
static const float hardCodedHpfpLobeProfileQuantityBins[16]
static const float hardCodedHpfpLobeProfileAngle[16]
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileQuantityBins[HPFP_LOBE_PROFILE_SIZE]
scaled_channel< uint16_t, 1000, 1 > hpfpCompensationLoadBins[HPFP_COMPENSATION_SIZE]
scaled_channel< uint8_t, 1, 50 > hpfpTargetRpmBins[HPFP_TARGET_SIZE]
uint16_t hpfpTarget[HPFP_TARGET_SIZE][HPFP_TARGET_SIZE]
scaled_channel< uint8_t, 1, 50 > hpfpCompensationRpmBins[HPFP_COMPENSATION_SIZE]
scaled_channel< uint16_t, 10, 1 > hpfpTargetLoadBins[HPFP_TARGET_SIZE]
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileAngle[HPFP_LOBE_PROFILE_SIZE]
void setRpmTableBin(TValue(&array)[TSize])
Definition: table_helper.h:199

Referenced by setDefaultEngineConfiguration(), and setTest33816EngineConfiguration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDiscovery33810Test()

void setDiscovery33810Test ( )

set engine_type 59

Definition at line 55 of file custom_engine.cpp.

55  {
56 // spi3mosiPin = Gpio::B5 grey
57 // spi3misoPin = Gpio::B4; vio
58 // spi3sckPin = Gpio::B3; blue
59 // CS PC5 white
60 // EN PA6 yellow
61 
62  engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
63  engineConfiguration->clt.adcChannel = EFI_ADC_NONE;
66 
68 
73 
78 
81 }
@ MC33810_0_GD_3
@ MC33810_0_OUT_0
@ MC33810_0_GD_2
@ MC33810_0_OUT_1
@ MC33810_0_GD_1
@ MC33810_0_GD_0

Referenced by resetConfigurationExt().

Here is the caller graph for this function:

◆ setDiscoveryPdm()

void setDiscoveryPdm ( )

Definition at line 40 of file custom_engine.cpp.

40  {
41 }

◆ setDiscoveryTLE9104Test()

void setDiscoveryTLE9104Test ( )

set engine_type 56 https://github.com/rusefi/rusefi-hardware/tree/main/tle9104-breakout

Definition at line 49 of file custom_engine.cpp.

49  {
50 }

Referenced by resetConfigurationExt().

Here is the caller graph for this function:

◆ setEepromTestConfiguration()

void setEepromTestConfiguration ( )

set engine_type 61

Definition at line 301 of file custom_engine.cpp.

301  {
304  // dirty hack
306  efiSetPadMode("I2C", Gpio::A8, PAL_MODE_ALTERNATE(4));
307  efiSetPadMode("I2C", Gpio::C9, PAL_MODE_ALTERNATE(4));
308 
309 
310  addConsoleActionI("ee_read",
311  [](int value) {
312  if (ifile.vmt != eepdev_24xx.efsvmt) {
313  EepromFileOpen((EepromFileStream *)&ifile, (EepromFileConfig *)&i2cee, &eepdev_24xx);
314  }
315 
316  ifile.vmt->setposition(&ifile, 0);
317 // chFileStreamSeek(&ifile, 0);
318  int v2;
319  streamRead(&ifile, (uint8_t *)&v2, 4);
320  efiPrintf("EE has %d", v2);
321 
322  v2 += 3;
323  ifile.vmt->setposition(&ifile, 0);
324  streamWrite(&ifile, (uint8_t *)&v2, 4);
325 
326 
327  });
328 
329 
330 }
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
void addConsoleActionI(const char *token, VoidInt callback)
Register a console command with one Integer parameter.
EepromDevice eepdev_24xx
static I2CEepromFileStream ifile
void brain_pin_markUnused(brain_pin_e brainPin)

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEtbTestConfiguration()

void setEtbTestConfiguration ( )

remember that some H-bridges require 5v control lines, not just 3v logic outputs we have on stm32

Definition at line 222 of file custom_engine.cpp.

222  {
223  // VAG test ETB
225  // by the way this ETB has default position of ADC=74 which is about 4%
227 
228  // yes, 30K - that's a test configuration
230 
233 
234 
239  /**
240  * remember that some H-bridges require 5v control lines, not just 3v logic outputs we have on stm32
241  */
242  engineConfiguration->etbIo[0].directionPin1 = Gpio::C7; // Frankenso high-side in order to get 5v control
245 
246 #if EFI_ELECTRONIC_THROTTLE_BODY
248 #endif /* EFI_ELECTRONIC_THROTTLE_BODY */
249 
250  engineConfiguration->tps1_1AdcChannel = EFI_ADC_2; // PA2
252 
253  // turning off other PWMs to simplify debugging
259 
260  // no analog dividers - all sensors with 3v supply, naked discovery bench setup
262 
263  // EFI_ADC_15 = PC5
264  engineConfiguration->clt.adcChannel = EFI_ADC_15;
266 
267  // see also setDefaultEtbBiasCurve
268 }
void setBoschVNH2SP30Curve()
void setCrankOperationMode()
void set10K_4050K(ThermistorConf *thermistorConf, float pullup)
Definition: thermistors.cpp:49

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFrankensoBoardTestConfiguration()

void setFrankensoBoardTestConfiguration ( )

set engine_type 49

Definition at line 173 of file custom_engine.cpp.

173  {
175 
178 
180  engineConfiguration->firingOrder = FO_1_7_5_11_3_9_6_12_2_8_4_10;
181 
182  // set ignition_mode 1
183  engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
184 
185  engineConfiguration->injectionPins[0] = Gpio::B7; // injector in default pinout
186  engineConfiguration->injectionPins[1] = Gpio::B8; // injector in default pinout
187  engineConfiguration->injectionPins[2] = Gpio::B9; // injector in default pinout
189 
193  engineConfiguration->injectionPins[7] = Gpio::E2; // injector in default pinout
198 
203 
204 
205  engineConfiguration->ignitionPins[0] = Gpio::C9; // coil in default pinout
206  engineConfiguration->ignitionPins[1] = Gpio::C7; // coil in default pinout
207  engineConfiguration->ignitionPins[2] = Gpio::E10; // coil in default pinout
208  engineConfiguration->ignitionPins[3] = Gpio::E8; // Miata VVT tach
209 
210  engineConfiguration->ignitionPins[4] = Gpio::E14; // coil in default pinout
214 
215  engineConfiguration->ignitionPins[8] = Gpio::E0; // brain board, not discovery
216  engineConfiguration->ignitionPins[9] = Gpio::E1; // brain board, not discovery
217 }
void setFrankensoConfiguration()

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFrankensoConfiguration()

void setFrankensoConfiguration ( )

Frankenso analog #1 PC2 ADC12 CLT Frankenso analog #2 PC1 ADC11 IAT Frankenso analog #3 PA0 ADC0 MAP Frankenso analog #4 PC3 ADC13 WBO / O2 Frankenso analog #5 PA2 ADC2 TPS Frankenso analog #6 PA1 ADC1 Frankenso analog #7 PA4 ADC4 Frankenso analog #8 PA3 ADC3 Frankenso analog #9 PA7 ADC7 Frankenso analog #10 PA6 ADC6 Frankenso analog #11 PC5 ADC15 Frankenso analog #12 PC4 ADC14 VBatt

http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board

Definition at line 85 of file custom_engine.cpp.

85  {
86 #ifdef HW_FRANKENSO
88 
90 
91  /**
92  * Frankenso analog #1 PC2 ADC12 CLT
93  * Frankenso analog #2 PC1 ADC11 IAT
94  * Frankenso analog #3 PA0 ADC0 MAP
95  * Frankenso analog #4 PC3 ADC13 WBO / O2
96  * Frankenso analog #5 PA2 ADC2 TPS
97  * Frankenso analog #6 PA1 ADC1
98  * Frankenso analog #7 PA4 ADC4
99  * Frankenso analog #8 PA3 ADC3
100  * Frankenso analog #9 PA7 ADC7
101  * Frankenso analog #10 PA6 ADC6
102  * Frankenso analog #11 PC5 ADC15
103  * Frankenso analog #12 PC4 ADC14 VBatt
104  */
105  engineConfiguration->tps1_1AdcChannel = EFI_ADC_2; // PA2
106 
108 
109  engineConfiguration->clt.adcChannel = EFI_ADC_12;
110  engineConfiguration->iat.adcChannel = EFI_ADC_11;
111  engineConfiguration->afr.hwChannel = EFI_ADC_13;
112 
115 
116 
117  /**
118  * http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board
119  */
120  // Frankenso low out #1: PE6
121  // Frankenso low out #2: PE5
122  // Frankenso low out #3: PD7 Main Relay
123  // Frankenso low out #4: PC13 Idle valve solenoid
124  // Frankenso low out #5: PE3
125  // Frankenso low out #6: PE4 fuel pump relay
126  // Frankenso low out #7: PE1 (do not use with discovery!)
127  // Frankenso low out #8: PE2 injector #2
128  // Frankenso low out #9: PB9 injector #1
129  // Frankenso low out #10: PE0 (do not use with discovery!)
130  // Frankenso low out #11: PB8 injector #3
131  // Frankenso low out #12: PB7 injector #4
132 
136 
138 
142 #ifndef EFI_INJECTOR_PIN3
144 #else /* EFI_INJECTOR_PIN3 */
145  engineConfiguration->injectionPins[3] = EFI_INJECTOR_PIN3; // #4
146 #endif /* EFI_INJECTOR_PIN3 */
147 
148  setAlgorithm(LM_SPEED_DENSITY);
149 
158 
162  // set_ignition_pin 4 PE10
164 
165  // todo: 8.2 or 10k?
166  engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2;
167 #endif // HW_FRANKENSO
168 }
void commonFrankensoAnalogInputs()
void setAlgorithm(engine_load_mode_e algo)

Referenced by common2jz(), resetConfigurationExt(), setDodgeRam1996(), setEngineTemplateConfiguration(), setFrankensoBoardTestConfiguration(), setMiataNA6_MAP_Frankenso(), setVwAba(), and testEngine6451().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setL9779TestConfiguration()

void setL9779TestConfiguration ( )

◆ setRotary()

void setRotary ( )

set engine_type 107

Definition at line 688 of file custom_engine.cpp.

688  {
691 
693  // todo: fix UI to make this possible via TS
695 
696  strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA);
697  strcpy(engineConfiguration->engineCode, "13B");
698  strcpy(engineConfiguration->vehicleName, "test");
699 
700  engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
701  engineConfiguration->injectionPins[2] = Gpio::Unassigned; // injector in default pinout
703 
707 }
void setTwoStrokeOperationMode()

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTest33816EngineConfiguration()

void setTest33816EngineConfiguration ( )

set engine_type 103

Definition at line 712 of file custom_engine.cpp.

712  {
713 
714  // grey
715  // default spi3mosiPin PB5
716  // white
717  // default spi3misoPin PB4
718  // violet
719  // default spi3sckPin PB3
720 
721 
724 
729 
730 
731  // blue
733  // green
736  // yellow
738 
740 
741  // enable_spi 3
743  // Wire up spi3
747 
749 
750  engineConfiguration->mc33816spiDevice = SPI_DEVICE_3;
752 }
void setBoschHDEV_5_injectors()

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testEngine6451()

void testEngine6451 ( )

Definition at line 955 of file custom_engine.cpp.

955  {
956 #ifdef HW_FRANKENSO
958 #endif
960 
964  engineConfiguration->firingOrder = FO_1_5_3_6_2_4;
965  engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
967 }
void setWholeTimingTable(angle_t value)
scaled_channel< int8_t, 10, 1 > ignitionIatCorrTable[8][8]

Referenced by resetConfigurationExt().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ eepdev_24xx

EepromDevice eepdev_24xx
extern

◆ hardCodedHpfpLobeProfileAngle

const float hardCodedHpfpLobeProfileAngle[16]
static
Initial value:
= {0.0, 7.5, 16.5, 24.0,
32.0 , 40.0, 48.0, 56.0,
64.0 , 72.0, 80.0, 88.0,
96.0 , 103.5, 112.5, 120.0
}

Definition at line 647 of file custom_engine.cpp.

Referenced by setBoschHDEV_5_injectors().

◆ hardCodedHpfpLobeProfileQuantityBins

const float hardCodedHpfpLobeProfileQuantityBins[16]
static
Initial value:
= {0.0, 1.0, 4.5, 9.5,
16.5, 25.0, 34.5, 45.0 ,
55.0, 65.5, 75.0, 83.5,
90.5, 95.5, 99.0, 100.0}

Definition at line 642 of file custom_engine.cpp.

Referenced by setBoschHDEV_5_injectors().

◆ i2cee

const I2CEepromFileConfig i2cee
static
Initial value:
= {
.barrier_low = 0,
.barrier_hi = EE_SIZE - 1,
.size = EE_SIZE,
.pagesize = EE_PAGE_SIZE,
.write_time = TIME_MS2I(EEPROM_WRITE_TIME_MS),
.i2cp = &EE_U2CD,
.addr = 0x50,
.write_buf = write_buf
}
static uint8_t write_buf[EE_PAGE_SIZE+10]

https://www.onsemi.com/pdf/datasheet/cat24c32-d.pdf CAT24C32

Definition at line 284 of file custom_engine.cpp.

◆ ifile

I2CEepromFileStream ifile
static

Definition at line 296 of file custom_engine.cpp.

Referenced by setEepromTestConfiguration().

◆ write_buf

uint8_t write_buf[EE_PAGE_SIZE+10]
static

Definition at line 275 of file custom_engine.cpp.

Go to the source code of this file.