26#if EFI_ELECTRONIC_THROTTLE_BODY
38#if defined(HW_NUCLEO_F767) || defined(HW_NUCLEO_H743) || defined(HW_FRANKENSO)
130#ifndef EFI_INJECTOR_PIN3
184#if EFI_ELECTRONIC_THROTTLE_BODY
204#if defined(HW_FRANKENSO) && EFI_PROD_CODE && HAL_USE_EEPROM
211#define EEPROM_WRITE_TIME_MS 10
217static const I2CEepromFileConfig
i2cee = {
219 .barrier_hi = EE_SIZE - 1,
221 .pagesize = EE_PAGE_SIZE,
222 .write_time = TIME_MS2I(EEPROM_WRITE_TIME_MS),
246 EepromFileOpen((EepromFileStream *)&ifile, (EepromFileConfig *)&i2cee, &eepdev_24xx);
252 streamRead(&
ifile, (uint8_t *)&v2, 4);
253 efiPrintf(
"EE has %d", v2);
257 streamWrite(&
ifile, (uint8_t *)&v2, 4);
301mapSensor = Sensor.new("map")
302mapSensor : setTimeout(3000)
305 local tps = getSensor("TPS1")
306 tps = (tps == nil and 0 or tps)
337 for (
int i = 0; i < MAX_CYLINDER_COUNT;i++) {
361 auxV = getAuxAnalog(0)
362 print('Hello analog ' .. auxV )
363 -- first byte: integer part, would be autoboxed to int
365 -- second byte: fractional part, would be autoboxed to int, overflow would be ignored
366 txPayload[2] = auxV * 256;
367 auxV = getAuxAnalog(1)
368 print('Hello analog ' .. auxV )
370 txPayload[4] = auxV * 256;
371 auxV = getAuxAnalog(2)
372 print('Hello analog ' .. auxV )
374 txPayload[6] = auxV * 256;
375 txCan(1, 0x600, 1, txPayload)
388#if HPFP_LOBE_PROFILE_SIZE == 16
389static const float hardCodedHpfpLobeProfileQuantityBins[16] = {0.0, 1.0, 4.5, 9.5,
39016.5, 25.0, 34.5, 45.0 ,
39155.0, 65.5, 75.0, 83.5,
39290.5, 95.5, 99.0, 100.0};
506 0, 1, 2, 4, 7, 98, 99, 100
509 -20, -18, -17, 0, 20, 21, 22, 25
564pid = Pid.new(2, 0, 0, -100, 100)
566biasCurveIndex = findCurveIndex("bias")
571function onCanRx(bus, id, dlc, data)
572 print('got CAN id=' .. id .. ' dlc=' .. dlc)
573 voltageFromCan = data[2] / 256.0 + data[1]
577 local targetVoltage = getAuxAnalog(0)
579-- local target = interpolate(1, 0, 3.5, 100, targetVoltage)
580 local target = interpolate(1, 0, 3.5, 100, voltageFromCan)
582 target = math.max(0, target)
583 target = math.min(100, target)
585 print('Decoded target: ' .. target)
587 local tps = getSensor("TPS1")
588 tps = (tps == nil and 'invalid TPS' or tps)
591 local output = pid:get(target, tps)
593 local bias = curve(biasCurveIndex, target)
594 print('bias ' .. bias)
596 local duty = (bias + output) / 100
597 isPositive = duty > 0;
598 pwmValue = isPositive and duty or -duty
599 setPwmDuty(0, pwmValue)
601 dirValue = isPositive and 1 or 0;
602 setPwmDuty(1, dirValue)
604 print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
613#if HW_HELLEN && EFI_PROD_CODE
623#if EFI_ENGINE_CONTROL
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.
void setEtbTestConfiguration()
void setFrankensoConfiguration()
void setL9779TestConfiguration()
static uint8_t write_buf[EE_PAGE_SIZE+10]
void setBodyControlUnit()
void setTest33816EngineConfiguration()
void setEepromTestConfiguration()
void setDiscovery33810Test()
static void setBasicNotECUmode()
void proteusDcWastegateTest()
void setBoschHDEV_5_injectors()
static const I2CEepromFileConfig i2cee
static I2CEepromFileStream ifile
void setHpfpLobeProfileAngle(int lobes)
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax)
static const float defaultBiasValues[]
static const float defaultBiasBins[]
void setBoschVNH2SP30Curve()
void commonFrankensoAnalogInputs()
void setCrankOperationMode()
void setWholeTimingTable(angle_t value)
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
void setAlgorithm(engine_load_mode_e algo)
void setFlatInjectorLag(float value)
void detectHellenBoardType()
void brain_pin_markUnused(brain_pin_e brainPin)
air_pressure_sensor_config_s sensor
bool enableTrailingSparks
vehicle_info_t engineMake
adc_channel_e tps1_1AdcChannel
adc_channel_e tps2_2AdcChannel
output_pin_e trailingCoilPins[MAX_CYLINDER_COUNT]
brain_input_pin_e vehicleSpeedSensorInputPin
Gpio mc33810_cs[C_MC33810_COUNT]
Gpio triggerSimulatorPins[TRIGGER_SIMULATOR_PIN_COUNT]
uint16_t mc33_t_min_boost
linear_sensor_s auxLinear2
ignition_mode_e ignitionMode
gppwm_note_t scriptCurveName[SCRIPT_CURVE_COUNT]
dc_function_e etbFunctions[ETB_COUNT]
adc_channel_e auxAnalogInputs[LUA_ANALOG_INPUT_COUNT]
adc_channel_e throttlePedalPositionSecondAdcChannel
tps_limit_t tps1SecondaryMax
cranking_parameters_s cranking
uint16_t triggerSimulatorRpm
vehicle_info_t vehicleName
scaled_channel< uint8_t, 10, 1 > mc33_hpfp_i_hold
float wastegatePositionOpenedVoltage
output_pin_e mainRelayPin
float analogInputDividerCoefficient
bool isBoostControlEnabled
uint8_t mc33_hpfp_max_hold
vvt_mode_e vvtMode[CAMS_PER_BANK]
output_pin_e injectionPins[MAX_CYLINDER_COUNT]
uint8_t mc33_hpfp_i_hold_off
spi_device_e l9779spiDevice
float wastegatePositionClosedVoltage
uint16_t mc33_t_max_boost
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
switch_input_pin_e brakePedalPin
linear_sensor_s oilPressure
firing_order_e firingOrder
vehicle_info_t engineCode
tps_limit_t tps1SecondaryMin
linear_sensor_s auxLinear1
brain_input_pin_e camInputs[CAM_INPUTS_COUNT]
output_pin_e ignitionPins[MAX_CYLINDER_COUNT]
adc_channel_e tps2_1AdcChannel
ThermistorConf oilTempSensor
spi_device_e mc33816spiDevice
scaled_channel< uint8_t, 10, 1 > mc33_hpfp_i_peak
output_pin_e luaOutputPins[LUA_PWM_COUNT]
adc_channel_e wastegatePositionSensor
adc_channel_e throttlePedalPositionAdcChannel
scaled_channel< uint8_t, 2, 1 > hpfpLobeProfileQuantityBins[HPFP_LOBE_PROFILE_SIZE]
float crankingFuelCoef[CRANKING_CURVE_SIZE]
float crankingCycleBaseFuel[CRANKING_CYCLE_CLT_SIZE][CRANKING_CURVE_SIZE]
float scriptCurve3[SCRIPT_CURVE_8]
scaled_channel< uint16_t, 1000, 1 > hpfpCompensationLoadBins[HPFP_COMPENSATION_SIZE]
uint8_t hpfpDeadtimeVoltsBins[HPFP_DEADTIME_SIZE]
float postCrankingFactor[CRANKING_ENRICH_CLT_COUNT][CRANKING_ENRICH_COUNT]
float scriptCurve2Bins[SCRIPT_CURVE_16]
float scriptCurve3Bins[SCRIPT_CURVE_8]
scaled_channel< uint8_t, 1, 50 > hpfpCompensationRpmBins[HPFP_COMPENSATION_SIZE]
scaled_channel< int16_t, 10, 1 > ignitionIatCorrTable[IAT_IGN_CORR_LOAD_COUNT][IAT_IGN_CORR_COUNT]
float scriptCurve2[SCRIPT_CURVE_16]
constexpr void setTable(TElement(&dest)[N][M], const VElement value)
void setRpmTableBin(TValue(&array)[TSize])
void setLinearCurve(TValue(&array)[TSize], float from, float to, float precision=0.01f)
void setArrayValues(TValue(&array)[TSize], float value)
void setCommonNTCSensor(ThermistorConf *thermistorConf, float pullup)