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

static void toggleTestAndScheduleNext (void *)
 
void runSchedulingPrecisionTestIfNeeded (void)
 
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 int periodIndex = 0
 
static OutputPin testPin
 
static scheduling_s testScheduling
 
static int test557 [] = {5, 5, 10, 10, 20, 20, 50, 50, 100, 100, 200, 200, 500, 500, 500, 500}
 
efitimeus_t testTime
 
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 992 of file custom_engine.cpp.

992  {
994  engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
995  engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
996 
997  engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CAM; // C7
998  engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_D_4; // E6
999  engineConfiguration->camInputs[0] = Gpio::H144_IN_VSS; // C4
1000  engineConfiguration->camInputs[1] = Gpio::H144_IN_D_AUX4; // E7
1001  engineConfiguration->camInputs[2] = Gpio::H144_IN_SENS2; // E3
1002  engineConfiguration->camInputs[3] = Gpio::H144_IN_SENS3; // E4
1003 }
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 929 of file custom_engine.cpp.

929  {
930 #if HW_HELLEN && EFI_PROD_CODE
932 #endif //HW_HELLEN EFI_PROD_CODE
933  // todo: add board ID detection?
934  // see hellen128 which has/had alternative i2c board id?
935 }
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 937 of file custom_engine.cpp.

937  {
939 #if EFI_ENGINE_CONTROL
941 #endif // EFI_ENGINE_CONTROL
946 }
static void setBasicNotECUmode()
void setFlatInjectorLag(float value)
persistent_config_s * config
float postCrankingFactor[CRANKING_ENRICH_COUNT][CRANKING_ENRICH_COUNT]
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 573 of file custom_engine.cpp.

573  {
574  mreSecondaryCan();
575  // maybe time to kill this feature is pretty soon?
577 }
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 583 of file custom_engine.cpp.

583  {
584 #if (BOARD_TLE8888_COUNT > 0)
585  engineConfiguration->debugMode = DBG_TLE8888;
586 
588  // set cranking_rpm 500
590  // set cranking_dwell 200
592  // set cranking_fuel 300
594  engineConfiguration->injectionMode = IM_SEQUENTIAL;
596 
597  // EFI_ADC_1: "23 - AN temp 2"
598  // test harness: Red/Green, 2K PD. expected 2.0v
599  // iat in microrusefi/board_configuration.cpp
600 
601  // EFI_ADC_2: "24 - AN temp 3"
602  // test harness: Blue/White, 2K PD. expected 2.0v
603 
604 
605  // EFI_ADC_10: "27 - AN volt 1"
606  // test harness: Blue/Red, 3.84K PD / 5.3 PU. expected 1.6v
607  engineConfiguration->mafAdcChannel = EFI_ADC_10;
608 
609  // EFI_ADC_14: "32 - AN volt 6"
610  // test harness: Red/White 3.6K PD / 5.2 PU. expected 1.6v
612 
613  // EFI_ADC_4: "28 - AN volt 10"
614  // test harness: Red/Yellow
615  engineConfiguration->afr.hwChannel = EFI_ADC_4;
616 
617  // EFI_ADC_7: "31 - AN volt 3"
618  // test harness: White/Red
620 
624 
625 
626 #endif /* BOARD_TLE8888_COUNT */
627 
629  engineConfiguration->firingOrder = FO_1_2_3_4_5_6_7_8_9_10_11_12;
630  engineConfiguration->injector.flow = 5; // longer blink
631 
632 
633 #if (BOARD_TLE8888_COUNT > 0)
640 
643 
644  // LED #8
645  // TLE8888 half bridges (pushpull, lowside, or high-low) IN12
646  // Gpio::TLE8888_PIN_21: "35 - GP Out 1"
648 
649  // LED #1
650  // Gpio::TLE8888_PIN_22: "34 - GP Out 2"
652 
653  // LED #2
654  // Gpio::TLE8888_PIN_23: "33 - GP Out 3"
655  engineConfiguration->ignitionPins[11 - 1] = MRE_GPOUT_3;
656 
657  // LED #7
658  // Gpio::TLE8888_PIN_24: "43 - GP Out 4"
660 
661  engineConfiguration->afr.hwChannel = EFI_ADC_6;
663 
664  // TLE8888 high current low side: IN10
665  // Gpio::TLE8888_PIN_6: "7 - Lowside 1"
667 
668  // TLE8888 high current low side: VVT2 IN9 / OUT5
669  // Gpio::TLE8888_PIN_5: "3 - Lowside 2"
671 
672  // Gpio::TLE8888_PIN_4: INJ#4
674  // Gpio::TLE8888_PIN_3: INJ#3
676  // Gpio::TLE8888_PIN_2: INJ#2
678  // Gpio::TLE8888_PIN_1: LED #3 - INJ#1
680 
681 
682  engineConfiguration->injectionPins[7 - 1] = Gpio::A4; // AV10
683  engineConfiguration->injectionPins[8 - 1] = Gpio::B1; // AV9
684  engineConfiguration->injectionPins[9 - 1] = Gpio::B0; // AV8
685  engineConfiguration->injectionPins[10 - 1] = Gpio::C4; // AV6
686 
688 
690 #endif /* BOARD_TLE8888_COUNT */
691 
692 }
@ 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 536 of file custom_engine.cpp.

536  {
538 
539  engineConfiguration->auxAnalogInputs[0] = MRE_IN_TPS;
540  engineConfiguration->auxAnalogInputs[1] = MRE_IN_MAP;
541  engineConfiguration->auxAnalogInputs[2] = MRE_IN_CLT;
542  engineConfiguration->auxAnalogInputs[3] = MRE_IN_IAT;
543  // engineConfiguration->auxAnalogInputs[0] =
544 
545 
546  // EFI_ADC_14: "32 - AN volt 6"
547 // engineConfiguration->afr.hwChannel = EFI_ADC_14;
548 
549 
550  strncpy(config->luaScript, R"(
551 txPayload = {}
552 function onTick()
553  auxV = getAuxAnalog(0)
554  print('Hello analog ' .. auxV )
555  -- first byte: integer part, would be autoboxed to int
556  txPayload[1] = auxV
557  -- second byte: fractional part, would be autoboxed to int, overflow would be ignored
558  txPayload[2] = auxV * 256;
559  auxV = getAuxAnalog(1)
560  print('Hello analog ' .. auxV )
561  txPayload[3] = auxV
562  txPayload[4] = auxV * 256;
563  auxV = getAuxAnalog(2)
564  print('Hello analog ' .. auxV )
565  txPayload[5] = auxV
566  txPayload[6] = auxV * 256;
567  txCan(1, 0x600, 1, txPayload)
568 end
569 )", efi::size(config->luaScript));
570 
571 }
void setBodyControlUnit()
adc_channel_e auxAnalogInputs[LUA_ANALOG_INPUT_COUNT]
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 438 of file custom_engine.cpp.

438  {
440  engineConfiguration->firingOrder = FO_1_2_3_4_5_6_7_8_9_10_11_12;
442  engineConfiguration->injector.flow = 4.6; // longer blink
443 
445  engineConfiguration->injectionMode = IM_SEQUENTIAL;
447 
451 
452 #if EFI_PROD_CODE
453  engineConfiguration->injectionPins[0] = Gpio::PROTEUS_LS_1;
454  engineConfiguration->injectionPins[1] = Gpio::PROTEUS_LS_2;
455  engineConfiguration->injectionPins[2] = Gpio::PROTEUS_LS_3;
456  engineConfiguration->injectionPins[3] = Gpio::PROTEUS_LS_4;
457  engineConfiguration->injectionPins[4] = Gpio::PROTEUS_LS_5;
458  engineConfiguration->injectionPins[5] = Gpio::PROTEUS_LS_6;
459  engineConfiguration->injectionPins[6] = Gpio::PROTEUS_LS_9;
460  engineConfiguration->injectionPins[7] = Gpio::PROTEUS_LS_8;
461  engineConfiguration->injectionPins[8] = Gpio::PROTEUS_LS_11;
462  engineConfiguration->injectionPins[9] = Gpio::PROTEUS_LS_10;
463  engineConfiguration->injectionPins[10] = Gpio::PROTEUS_LS_12;
464  engineConfiguration->injectionPins[11] = Gpio::PROTEUS_LS_13;
465 
466 
467  engineConfiguration->luaOutputPins[0] = Gpio::PROTEUS_LS_7;
468  engineConfiguration->luaOutputPins[1] = Gpio::PROTEUS_LS_14;
469  engineConfiguration->luaOutputPins[2] = Gpio::PROTEUS_LS_15;
470  engineConfiguration->luaOutputPins[3] = Gpio::PROTEUS_LS_16;
471  engineConfiguration->luaOutputPins[4] = Gpio::PROTEUS_HS_2;
472  engineConfiguration->luaOutputPins[5] = Gpio::PROTEUS_HS_4;
473 
474  engineConfiguration->ignitionPins[0] = Gpio::PROTEUS_IGN_1;
475  engineConfiguration->ignitionPins[1] = Gpio::PROTEUS_IGN_2;
476  engineConfiguration->ignitionPins[2] = Gpio::PROTEUS_IGN_4;
477  engineConfiguration->ignitionPins[3] = Gpio::PROTEUS_IGN_5;
478  engineConfiguration->ignitionPins[4] = Gpio::PROTEUS_IGN_6;
479  engineConfiguration->ignitionPins[5] = Gpio::PROTEUS_IGN_7;
480 
481  engineConfiguration->ignitionPins[6] = Gpio::PROTEUS_HS_3;
482  engineConfiguration->ignitionPins[7] = Gpio::PROTEUS_IGN_3;
483  engineConfiguration->ignitionPins[8] = Gpio::PROTEUS_IGN_9;
484  engineConfiguration->ignitionPins[9] = Gpio::PROTEUS_IGN_8;
485  engineConfiguration->ignitionPins[10] = Gpio::PROTEUS_HS_1;
486  engineConfiguration->ignitionPins[11] = Gpio::PROTEUS_IGN_12;
487 
488  strncpy(config->luaScript, R"(
489  startPwm(0, 10, 0.5)
490  startPwm(1, 11, 0.5)
491  startPwm(2, 12, 0.5)
492  startPwm(3, 13, 0.5)
493  startPwm(4, 14, 0.5)
494  startPwm(5, 15, 0.5)
495  startPwm(6, 16, 0.5)
496  startPwm(7, 17, 0.5)
497 
498  function onTick()
499  end
500  )", efi::size(config->luaScript));
501 
502 #endif // EFI_PROD_CODE
503 
504 #if EFI_ELECTRONIC_THROTTLE_BODY
506 #endif // EFI_ELECTRONIC_THROTTLE_BODY
507 }
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 407 of file custom_engine.cpp.

407  {
409  engineConfiguration->etbFunctions[0] = DC_Wastegate;
410  engineConfiguration->etbFunctions[1] = DC_None;
411  engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
412 
414  setTPS1Calibration(98, 926, 891, 69);
415 
419 
420  strncpy(config->luaScript, R"(
421 
422 mapSensor = Sensor.new("map")
423 mapSensor : setTimeout(3000)
424 
425 function onTick()
426  local tps = getSensor("TPS1")
427  tps = (tps == nil and 0 or tps)
428  mapSensor : set(tps)
429 end
430 
431  )", efi::size(config->luaScript));
432 }
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 806 of file custom_engine.cpp.

806  {
807 #if HW_PROTEUS
810 
813 
814  strcpy(engineConfiguration->scriptCurveName[2 - 1], "rateofchange");
815 
816  strcpy(engineConfiguration->scriptCurveName[3 - 1], "bias");
817 
818  /**
819  * for this demo I use ETB just a sample object to control with PID. No reasonable person should consider actually using
820  * Lua for actual intake ETB control while driving around the racing track - hard-coded ETB control is way smarter!
821  */
822  static const float defaultBiasBins[] = {
823  0, 1, 2, 4, 7, 98, 99, 100
824  };
825  static const float defaultBiasValues[] = {
826  -20, -18, -17, 0, 20, 21, 22, 25
827  };
828 
832 
833  setLinearCurve(config->scriptCurve2Bins, 0, 8000, 1);
834  setLinearCurve(config->scriptCurve2, 0, 100, 1);
835 
838 
839  engineConfiguration->auxAnalogInputs[0] = PROTEUS_IN_ANALOG_VOLT_10;
840  engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
841 
842 
843  // ETB direction #1 PD10
845  // ETB control PD12
847  // ETB disable PD11
849 
850 /**
851 controlIndex = 0
852 directionIndex = 1
853 
854  print('pid output ' .. output)
855  print('')
856 
857 
858 
859  local duty = (bias + output) / 100
860 
861 -- isPositive = duty > 0;
862 -- pwmValue = isPositive and duty or -duty
863 -- setPwmDuty(controlIndex, pwmValue)
864 
865 -- dirValue = isPositive and 1 or 0;
866 -- setPwmDuty(directionIndex, dirValue)
867 
868 -- print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
869 
870  *
871  */
872 
873  auto script = R"(
874 
875 startPwm(0, 800, 0.1)
876 -- direction
877 startPwm(1, 80, 1.0)
878 -- disable
879 startPwm(2, 80, 0.0)
880 
881 pid = Pid.new(2, 0, 0, -100, 100)
882 
883 biasCurveIndex = findCurveIndex("bias")
884 
885 voltageFromCan = nil
886 canRxAdd(0x600)
887 
888 function onCanRx(bus, id, dlc, data)
889  print('got CAN id=' .. id .. ' dlc=' .. dlc)
890  voltageFromCan = data[2] / 256.0 + data[1]
891 end
892 
893 function onTick()
894  local targetVoltage = getAuxAnalog(0)
895 
896 -- local target = interpolate(1, 0, 3.5, 100, targetVoltage)
897  local target = interpolate(1, 0, 3.5, 100, voltageFromCan)
898 -- clamp 0 to 100
899  target = math.max(0, target)
900  target = math.min(100, target)
901 
902  print('Decoded target: ' .. target)
903 
904  local tps = getSensor("TPS1")
905  tps = (tps == nil and 'invalid TPS' or tps)
906  print('Tps ' .. tps)
907 
908  local output = pid:get(target, tps)
909 
910  local bias = curve(biasCurveIndex, target)
911  print('bias ' .. bias)
912 
913  local duty = (bias + output) / 100
914  isPositive = duty > 0;
915  pwmValue = isPositive and duty or -duty
916  setPwmDuty(0, pwmValue)
917 
918  dirValue = isPositive and 1 or 0;
919  setPwmDuty(1, dirValue)
920 
921  print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
922  print('')
923 end
924  )";
925  strncpy(config->luaScript, script, efi::size(config->luaScript));
926 #endif
927 }
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 951 of file custom_engine.cpp.

951  {
953  engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
954  engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
955 
956  engineConfiguration->triggerInputPins[0] = PROTEUS_DIGITAL_1;
957  engineConfiguration->triggerInputPins[1] = PROTEUS_DIGITAL_2;
958  engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_3;
959  engineConfiguration->camInputs[1] = PROTEUS_DIGITAL_4;
960  engineConfiguration->vehicleSpeedSensorInputPin = PROTEUS_DIGITAL_5;
961  engineConfiguration->brakePedalPin = PROTEUS_DIGITAL_6;
962 
963  setProteusEtbIO();
964  // EFI_ADC_13: "Analog Volt 4"
965  engineConfiguration->tps2_1AdcChannel = PROTEUS_IN_TPS2_1;
966  // EFI_ADC_0: "Analog Volt 5"
967  engineConfiguration->tps2_2AdcChannel = PROTEUS_IN_ANALOG_VOLT_5;
968  engineConfiguration->oilPressure.hwChannel = PROTEUS_IN_ANALOG_VOLT_6;
969  // pps2 volt 7
970 
971  // pps1 volt 9
972  // afr volt 10
973  engineConfiguration->oilTempSensor.adcChannel = PROTEUS_IN_ANALOG_VOLT_11;
975 
976 
977  engineConfiguration->auxLinear1.hwChannel = PROTEUS_IN_ANALOG_TEMP_1;
978  engineConfiguration->auxLinear2.hwChannel = PROTEUS_IN_ANALOG_TEMP_4;
979 
980 // engineConfiguration->fan2Pin = Gpio::PROTEUS_LS_9;
981 // engineConfiguration->malfunctionIndicatorPin = Gpio::PROTEUS_LS_13;
982 // engineConfiguration->tachOutputPin = Gpio::PROTEUS_LS_14;
983 //
984 // engineConfiguration->vvtPins[0] = Gpio::PROTEUS_LS_15;
985 // engineConfiguration->vvtPins[1] = Gpio::PROTEUS_LS_16;
986 }
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:

◆ runSchedulingPrecisionTestIfNeeded()

void runSchedulingPrecisionTestIfNeeded ( void  )

https://github.com/rusefi/rusefi/issues/557 common rail / direct injection scheduling control test

Definition at line 61 of file custom_engine.cpp.

61  {
63  return;
64  }
65 
67  testPin.setValue(0);
69  toggleTestAndScheduleNext(/*unused*/ nullptr);
70 }
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
Definition: efi_gpio.cpp:690
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition: efi_gpio.cpp:583
efitimeus_t testTime
static void toggleTestAndScheduleNext(void *)
static OutputPin testPin
efitimeus_t getTimeNowUs()
Definition: efitime.cpp:26
bool isBrainPinValid(brain_pin_e brainPin)

Referenced by runRusEfiWithConfig().

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

◆ setBasicNotECUmode()

static void setBasicNotECUmode ( )
static

Definition at line 510 of file custom_engine.cpp.

Referenced by fuelBenchMode(), and setBodyControlUnit().

Here is the caller graph for this function:

◆ setBodyControlUnit()

void setBodyControlUnit ( )

Definition at line 528 of file custom_engine.cpp.

528  {
529  for (int i = 0; i < MAX_CYLINDER_COUNT;i++) {
532  }
534 }

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 705 of file custom_engine.cpp.

705  {
709 
712  setTable(config->hpfpTarget, 5000);
713 
715  setLinearCurve(config->hpfpCompensationLoadBins, 0.005, 0.120, 0.001);
716 
717  // This is the configuration for bosch HDEV 5 injectors
718  // all times in microseconds/us
730 
731  engineConfiguration->mc33_hpfp_i_peak = 5; // A not mA like above
734  engineConfiguration->mc33_hpfp_max_hold = 10; // this value in ms not us
735 }
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 88 of file custom_engine.cpp.

88  {
89 // spi3mosiPin = Gpio::B5 grey
90 // spi3misoPin = Gpio::B4; vio
91 // spi3sckPin = Gpio::B3; blue
92 // CS PC5 white
93 // EN PA6 yellow
94 
95  engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
96  engineConfiguration->clt.adcChannel = EFI_ADC_NONE;
99 
101 
106 
111 
114 }
@ 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 73 of file custom_engine.cpp.

73  {
74 }

◆ setDiscoveryTLE9104Test()

void setDiscoveryTLE9104Test ( )

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

Definition at line 82 of file custom_engine.cpp.

82  {
83 }

Referenced by resetConfigurationExt().

Here is the caller graph for this function:

◆ setEepromTestConfiguration()

void setEepromTestConfiguration ( )

set engine_type 61

Definition at line 353 of file custom_engine.cpp.

353  {
356  // dirty hack
358  efiSetPadMode("I2C", Gpio::A8, PAL_MODE_ALTERNATE(4));
359  efiSetPadMode("I2C", Gpio::C9, PAL_MODE_ALTERNATE(4));
360 
361 
362  addConsoleActionI("ee_read",
363  [](int value) {
364  if (ifile.vmt != eepdev_24xx.efsvmt) {
365  EepromFileOpen((EepromFileStream *)&ifile, (EepromFileConfig *)&i2cee, &eepdev_24xx);
366  }
367 
368  ifile.vmt->setposition(&ifile, 0);
369 // chFileStreamSeek(&ifile, 0);
370  int v2;
371  streamRead(&ifile, (uint8_t *)&v2, 4);
372  efiPrintf("EE has %d", v2);
373 
374  v2 += 3;
375  ifile.vmt->setposition(&ifile, 0);
376  streamWrite(&ifile, (uint8_t *)&v2, 4);
377 
378 
379  });
380 
381 
382 }
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 272 of file custom_engine.cpp.

272  {
273  // VAG test ETB
274  // set tps_min 54
276  // by the way this ETB has default position of ADC=74 which is about 4%
277  // set tps_max 540
279 
280  // yes, 30K - that's a test configuration
282 
285 
286 
291  /**
292  * remember that some H-bridges require 5v control lines, not just 3v logic outputs we have on stm32
293  */
294  engineConfiguration->etbIo[0].directionPin1 = Gpio::C7; // Frankenso high-side in order to get 5v control
297 
298 #if EFI_ELECTRONIC_THROTTLE_BODY
300 #endif /* EFI_ELECTRONIC_THROTTLE_BODY */
301 
302  engineConfiguration->tps1_1AdcChannel = EFI_ADC_2; // PA2
304 
305  // turning off other PWMs to simplify debugging
311 
312  // no analog dividers - all sensors with 3v supply, naked discovery bench setup
314 
315  // EFI_ADC_15 = PC5
316  engineConfiguration->clt.adcChannel = EFI_ADC_15;
318 
319  // see also setDefaultEtbBiasCurve
320 }
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 223 of file custom_engine.cpp.

223  {
225 
228 
230  engineConfiguration->firingOrder = FO_1_7_5_11_3_9_6_12_2_8_4_10;
231 
232  // set ignition_mode 1
233  engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
234 
235  engineConfiguration->injectionPins[0] = Gpio::B7; // injector in default pinout
236  engineConfiguration->injectionPins[1] = Gpio::B8; // injector in default pinout
237  engineConfiguration->injectionPins[2] = Gpio::B9; // injector in default pinout
239 
243  engineConfiguration->injectionPins[7] = Gpio::E2; // injector in default pinout
248 
253 
254 
255  engineConfiguration->ignitionPins[0] = Gpio::C9; // coil in default pinout
256  engineConfiguration->ignitionPins[1] = Gpio::C7; // coil in default pinout
257  engineConfiguration->ignitionPins[2] = Gpio::E10; // coil in default pinout
258  engineConfiguration->ignitionPins[3] = Gpio::E8; // Miata VVT tach
259 
260  engineConfiguration->ignitionPins[4] = Gpio::E14; // coil in default pinout
264 
265  engineConfiguration->ignitionPins[8] = Gpio::E0; // brain board, not discovery
266  engineConfiguration->ignitionPins[9] = Gpio::E1; // brain board, not discovery
267 }
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

We want to initialize all outputs for test

Definition at line 118 of file custom_engine.cpp.

118  {
119 #ifdef HW_FRANKENSO
121 
123 
124  /**
125  * Frankenso analog #1 PC2 ADC12 CLT
126  * Frankenso analog #2 PC1 ADC11 IAT
127  * Frankenso analog #3 PA0 ADC0 MAP
128  * Frankenso analog #4 PC3 ADC13 WBO / O2
129  * Frankenso analog #5 PA2 ADC2 TPS
130  * Frankenso analog #6 PA1 ADC1
131  * Frankenso analog #7 PA4 ADC4
132  * Frankenso analog #8 PA3 ADC3
133  * Frankenso analog #9 PA7 ADC7
134  * Frankenso analog #10 PA6 ADC6
135  * Frankenso analog #11 PC5 ADC15
136  * Frankenso analog #12 PC4 ADC14 VBatt
137  */
138  engineConfiguration->tps1_1AdcChannel = EFI_ADC_2; // PA2
139 
141 
142  engineConfiguration->clt.adcChannel = EFI_ADC_12;
143  engineConfiguration->iat.adcChannel = EFI_ADC_11;
144  engineConfiguration->afr.hwChannel = EFI_ADC_13;
145 
148 
149 
150  /**
151  * http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board
152  */
153  // Frankenso low out #1: PE6
154  // Frankenso low out #2: PE5
155  // Frankenso low out #3: PD7 Main Relay
156  // Frankenso low out #4: PC13 Idle valve solenoid
157  // Frankenso low out #5: PE3
158  // Frankenso low out #6: PE4 fuel pump relay
159  // Frankenso low out #7: PE1 (do not use with discovery!)
160  // Frankenso low out #8: PE2 injector #2
161  // Frankenso low out #9: PB9 injector #1
162  // Frankenso low out #10: PE0 (do not use with discovery!)
163  // Frankenso low out #11: PB8 injector #3
164  // Frankenso low out #12: PB7 injector #4
165 
169 
171 
175 #ifndef EFI_INJECTOR_PIN3
177 #else /* EFI_INJECTOR_PIN3 */
178  engineConfiguration->injectionPins[3] = EFI_INJECTOR_PIN3; // #4
179 #endif /* EFI_INJECTOR_PIN3 */
180 
181  setAlgorithm(LM_SPEED_DENSITY);
182 
183 #if EFI_PWM_TESTER
192 
193  /**
194  * We want to initialize all outputs for test
195  */
197 
198 #else /* EFI_PWM_TESTER */
207 
211  // set_ignition_pin 4 PE10
213 #endif /* EFI_PWM_TESTER */
214 
215  // todo: 8.2 or 10k?
216  engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2;
217 #endif // HW_FRANKENSO
218 }
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 740 of file custom_engine.cpp.

740  {
743 
745  // todo: fix UI to make this possible via TS
747 
748  strcpy(engineConfiguration->engineMake, ENGINE_MAKE_MAZDA);
749  strcpy(engineConfiguration->engineCode, "13B");
750  strcpy(engineConfiguration->vehicleName, "test");
751 
752  engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
753  engineConfiguration->injectionPins[2] = Gpio::Unassigned; // injector in default pinout
755 
759 }
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 764 of file custom_engine.cpp.

764  {
765 
766  // grey
767  // default spi3mosiPin PB5
768  // white
769  // default spi3misoPin PB4
770  // violet
771  // default spi3sckPin PB3
772 
773 
776 
781 
782 
783  // blue
785  // green
788  // yellow
790 
792 
793  // enable_spi 3
795  // Wire up spi3
799 
801 
802  engineConfiguration->mc33816spiDevice = SPI_DEVICE_3;
804 }
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 1007 of file custom_engine.cpp.

1007  {
1008 #ifdef HW_FRANKENSO
1010 #endif
1012 
1013  setWholeTimingTable(30);
1016  engineConfiguration->firingOrder = FO_1_5_3_6_2_4;
1017  engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
1019 }
void setWholeTimingTable(angle_t value)
void setWholeIgnitionIatCorr(float value)

Referenced by resetConfigurationExt().

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

◆ toggleTestAndScheduleNext()

static void toggleTestAndScheduleNext ( void *  )
static

Definition at line 51 of file custom_engine.cpp.

51  {
52  testPin.toggle();
53  periodIndex = (periodIndex + 1) % TEST_LEN;
56 }
SingleTimerExecutor executor
Definition: engine.h:241
void toggle()
Definition: efi_gpio.cpp:548
void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override
Schedule an event at specific delay after now.
static scheduling_s testScheduling
static int test557[]
static int periodIndex
Engine * engine

Referenced by runSchedulingPrecisionTestIfNeeded().

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 699 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 694 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 336 of file custom_engine.cpp.

◆ ifile

I2CEepromFileStream ifile
static

Definition at line 348 of file custom_engine.cpp.

Referenced by setEepromTestConfiguration().

◆ periodIndex

int periodIndex = 0
static

Definition at line 41 of file custom_engine.cpp.

Referenced by toggleTestAndScheduleNext().

◆ test557

int test557[] = {5, 5, 10, 10, 20, 20, 50, 50, 100, 100, 200, 200, 500, 500, 500, 500}
static

Definition at line 46 of file custom_engine.cpp.

Referenced by toggleTestAndScheduleNext().

◆ testPin

OutputPin testPin
static

◆ testScheduling

scheduling_s testScheduling
static

Definition at line 44 of file custom_engine.cpp.

Referenced by toggleTestAndScheduleNext().

◆ testTime

efitimeus_t testTime

◆ write_buf

uint8_t write_buf[EE_PAGE_SIZE+10]
static

Definition at line 327 of file custom_engine.cpp.

Go to the source code of this file.