rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
electronic_throttle.cpp File Reference

Detailed Description

Electronic Throttle driver.

See also
test test_etb.cpp

PPS=pedal position sensor=AcceleratorPedal TPS=throttle position sensor, this one is inside ETB=electronic throttle body

Limited user documentation at https://wiki.rusefi.com/HOWTO_electronic_throttle_body

ETB is controlled according to pedal position input (pedal position sensor is a potentiometer) pedal 0% means pedal not pressed / idle pedal 100% means pedal all the way down (not TPS - not the one you can calibrate in TunerStudio)

See also pid.cpp

Date
Dec 7, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

This file is part of rusEfi - see http://rusefi.com

rusEfi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file electronic_throttle.cpp.

Functions

void setHitachiEtbBiasBins ()
 
static SensorType functionToPositionSensor (dc_function_e func)
 
static SensorType functionToTpsSensor (dc_function_e func)
 
static SensorType functionToTpsSensorPrimary (dc_function_e func)
 
static SensorType functionToTpsSensorSecondary (dc_function_e func)
 
static TsCalMode functionToCalModePriMin (dc_function_e func)
 
static TsCalMode functionToCalModePriMax (dc_function_e func)
 
static TsCalMode functionToCalModeSecMin (dc_function_e func)
 
static TsCalMode functionToCalModeSecMax (dc_function_e func)
 
PUBLIC_API_WEAK bool isBoardAllowingLackOfPps ()
 
float getSanitizedPedal ()
 
PUBLIC_API_WEAK float boardAdjustEtbTarget (float currentEtbTarget)
 
void blinkEtbErrorCodes (bool blinkPhase)
 
void etbPidReset ()
 
void etbAutocal (dc_function_e function, bool reportToTs)
 
void etbBenchTestStart (size_t throttleIndex)
 
EtbStatus etbGetState (size_t throttleIndex)
 
void setBoschVAGETB ()
 
void setBoschVNH2SP30Curve ()
 
void setDefaultEtbParameters ()
 
void onConfigurationChangeElectronicThrottleCallback (engine_configuration_s *previousConfiguration)
 
void setDefaultEtbBiasCurve ()
 
void unregisterEtbPins ()
 
static pid_sgetPidForDcFunction (dc_function_e function)
 
PUBLIC_API_WEAK ValueProvider3Dpedal2TpsProvider ()
 
void doInitElectronicThrottle (bool isStartupInit)
 
void initElectronicThrottle ()
 
void setEtbIdlePosition (percent_t pos)
 
void setEtbWastegatePosition (percent_t pos)
 
void setEtbLuaAdjustment (percent_t pos)
 
void setEwgLuaAdjustment (percent_t pos)
 
void setToyota89281_33010_pedal_position_sensor ()
 
void setHitachiEtbCalibration ()
 
void setProteusHitachiEtbDefaults ()
 
template<>
const electronic_throttle_sgetLiveData (size_t idx)
 
void pickEtbOrStepper ()
 

Variables

static pedal2tps_t pedal2tpsMap {"p2t"}
 
static Map3D< ETB2_TRIM_RPM_SIZE, ETB2_TRIM_SIZE, int8_t, uint8_t, uint8_t > throttle2TrimTable {"t2t"}
 
static Map3D< TRACTION_CONTROL_ETB_DROP_SLIP_SIZE, TRACTION_CONTROL_ETB_DROP_SPEED_SIZE, int8_t, uint16_t, uint8_t > tcEtbDropTable {"tce"}
 
constexpr float etbPeriodSeconds = 1.0f / ETB_LOOP_FREQUENCY
 
static const float hardCodedetbHitachiBiasBins [8] = {0.0, 19.0, 21.0, 22.0, 23.0, 25.0, 30.0, 100.0}
 
static const float hardCodedetbHitachiBiasValues [8] = {-18.0, -17.0, -15.0, 0.0, 16.0, 20.0, 20.0, 20.0}
 
int ebtResetCounter
 
EtbImpl< EtbController1etb1
 
EtbImpl< EtbController2etb2 (throttle2TrimTable)
 
static EtbControlleretbControllers [] = { &etb1, &etb2 }
 
static DcThread dcThread CCM_OPTIONAL
 
static const float boschBiasBins []
 
static const float boschBiasValues []
 
static const float defaultBiasBins []
 
static const float defaultBiasValues []
 

Function Documentation

◆ blinkEtbErrorCodes()

void blinkEtbErrorCodes ( bool  blinkPhase)

Definition at line 733 of file electronic_throttle.cpp.

733 {
734 for (int i = 0;i<ETB_COUNT;i++) {
738 }
739 etbControllers[i]->etbErrorCodeBlinker = blinkPhase ? 0 : etbErrorCode;
740 }
741}
bool etbAutoTune
Definition engine.h:304
static EtbController * etbControllers[]
static EngineAccessor engine
Definition engine.h:415
etbErrorCode("etbErrorCode", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1884, 1.0, -1.0, -1.0, "")

Referenced by updateTunerStudioState().

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

◆ boardAdjustEtbTarget()

PUBLIC_API_WEAK float boardAdjustEtbTarget ( float  currentEtbTarget)

Definition at line 299 of file electronic_throttle.cpp.

299 {
300 return currentEtbTarget;
301}

Referenced by EtbController::getSetpointEtb().

Here is the caller graph for this function:

◆ doInitElectronicThrottle()

void doInitElectronicThrottle ( bool  isStartupInit)

Unexpected electronic throttle start-up position is worth a critical error

Definition at line 909 of file electronic_throttle.cpp.

909 {
910 bool anyEtbConfigured = false;
911
912 // todo: technical debt: we still have DC motor code initialization in ETB-specific file while DC motors are used not just as ETB
913 // like DC motor wastegate code flow should probably NOT go through electronic_throttle.cpp right?
914 // todo: rename etbFunctions to something-without-etb for same reason?
915 for (int i = 0 ; i < ETB_COUNT; i++) {
916 auto func = engineConfiguration->etbFunctions[i];
917 if (func == DC_None) {
918 // do not touch HW pins if function not selected, this way Lua can use DC motor hardware pins directly
919 continue;
920 }
921 auto motor = initDcMotor("ETB disable",
923
924 auto controller = engine->etbControllers[i];
925 criticalAssertVoid(controller != nullptr, "null ETB");
926
927 auto pid = getPidForDcFunction(func);
928
929 bool dcConfigured = controller->init(func, motor, pid, pedal2TpsProvider());
930 if (isStartupInit && dcConfigured) {
931 controller->reset("init");
932 }
933 anyEtbConfigured |= dcConfigured && controller->isEtbMode();
934 }
935
936 // It's not valid to have a PPS without any ETBs - check that at least one ETB was enabled along with the pedal
937 if (!anyEtbConfigured && Sensor::hasSensor(SensorType::AcceleratorPedalPrimary)) {
938 criticalError("A pedal position sensor was configured, but no electronic throttles are configured.");
939 }
940
941#if 0 && ! EFI_UNIT_TEST
942 percent_t startupThrottlePosition = getTPS();
943 if (std::abs(startupThrottlePosition - engineConfiguration->etbNeutralPosition) > STARTUP_NEUTRAL_POSITION_ERROR_THRESHOLD) {
944 /**
945 * Unexpected electronic throttle start-up position is worth a critical error
946 */
948 startupThrottlePosition,
950 startupPositionError = true;
951 }
952#endif /* EFI_UNIT_TEST */
953
954#if !EFI_UNIT_TEST
955 static bool started = false;
956 if (started == false) {
957 dcThread.start();
958 started = true;
959 }
960#endif
961}
IEtbController * etbControllers[ETB_COUNT]
Definition engine.h:130
virtual bool hasSensor() const
Definition sensor.h:145
DcMotor * initDcMotor(const char *disPinMsg, const dc_io &io, size_t index, bool useTwoWires)
Definition dc_motors.cpp:90
static pid_s * getPidForDcFunction(dc_function_e function)
PUBLIC_API_WEAK ValueProvider3D * pedal2TpsProvider()
static constexpr engine_configuration_s * engineConfiguration
void firmwareError(ObdCode code, const char *fmt,...)
@ OBD_Throttle_Actuator_Control_Range_Performance_Bank_1
float percent_t
@ AcceleratorPedalPrimary

Referenced by configureRusefiLuaHooks(), initElectronicThrottle(), and EtbController::onConfigurationChange().

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

◆ etbAutocal()

void etbAutocal ( dc_function_e  function,
bool  reportToTs 
)

Definition at line 774 of file electronic_throttle.cpp.

774 {
775 for (size_t i = 0 ; i < ETB_COUNT; i++) {
776 /* TODO: use from engine, add getFunction() to base class */
777 //if (auto controller = engine->etbControllers[i]) {
778 if (auto controller = etbControllers[i]) {
779 assertNotNullVoid(controller);
780 if (controller->getFunction() == function) {
781 /* TODO: is it possible that we have several controllers with same function? */
782 controller->autoCalibrateTps(reportToTs);
783 // todo fix root cause! work-around: make sure not to write bad tune since that would brick requestBurn();
784 }
785 }
786 }
787}

Referenced by handleCommandX14(), and initElectronicThrottle().

Here is the caller graph for this function:

◆ etbBenchTestStart()

void etbBenchTestStart ( size_t  throttleIndex)

Definition at line 789 of file electronic_throttle.cpp.

789 {
790 if (throttleIndex >= ETB_COUNT) {
791 efiPrintf("ETB bench test: invalid index %d", (int)throttleIndex);
792 return;
793 }
794 if (auto controller = etbControllers[throttleIndex]) {
795 assertNotNullVoid(controller);
796 controller->startBenchTest();
797 }
798}

Referenced by handleCommandX14().

Here is the caller graph for this function:

◆ etbGetState()

EtbStatus etbGetState ( size_t  throttleIndex)

Definition at line 800 of file electronic_throttle.cpp.

801{
802 if (throttleIndex >= ETB_COUNT) {
804 }
805
806 return (EtbStatus)etbControllers[throttleIndex]->etbErrorCode;
807}
EtbStatus

◆ etbPidReset()

void etbPidReset ( )

Definition at line 763 of file electronic_throttle.cpp.

763 {
764 for (int i = 0 ; i < ETB_COUNT; i++) {
765 if (auto controller = engine->etbControllers[i]) {
766 assertNotNullVoid(controller);
767 controller->reset("unit_test");
768 }
769 }
770 ebtResetCounter = 0;
771}
int ebtResetCounter

◆ functionToCalModePriMax()

static TsCalMode functionToCalModePriMax ( dc_function_e  func)
static

Definition at line 136 of file electronic_throttle.cpp.

136 {
137 switch (func) {
138 case DC_Throttle1: return TsCalMode::Tps1Max;
139 case DC_Throttle2: return TsCalMode::Tps2Max;
140 case DC_Wastegate: return TsCalMode::EwgPosMax;
141 default: return TsCalMode::None;
142 }
143}

Referenced by EtbImpl< TBase >::doAutocal().

Here is the caller graph for this function:

◆ functionToCalModePriMin()

static TsCalMode functionToCalModePriMin ( dc_function_e  func)
static

Definition at line 127 of file electronic_throttle.cpp.

127 {
128 switch (func) {
129 case DC_Throttle1: return TsCalMode::Tps1Min;
130 case DC_Throttle2: return TsCalMode::Tps2Min;
131 case DC_Wastegate: return TsCalMode::EwgPosMin;
132 default: return TsCalMode::None;
133 }
134}

Referenced by EtbImpl< TBase >::doAutocal().

Here is the caller graph for this function:

◆ functionToCalModeSecMax()

static TsCalMode functionToCalModeSecMax ( dc_function_e  func)
static

Definition at line 153 of file electronic_throttle.cpp.

153 {
154 switch (func) {
155 case DC_Throttle1: return TsCalMode::Tps1SecondaryMax;
156 case DC_Throttle2: return TsCalMode::Tps2SecondaryMax;
157 default: return TsCalMode::None;
158 }
159}
@ Tps1SecondaryMax
@ Tps2SecondaryMax

Referenced by EtbImpl< TBase >::doAutocal().

Here is the caller graph for this function:

◆ functionToCalModeSecMin()

static TsCalMode functionToCalModeSecMin ( dc_function_e  func)
static

Definition at line 145 of file electronic_throttle.cpp.

145 {
146 switch (func) {
147 case DC_Throttle1: return TsCalMode::Tps1SecondaryMin;
148 case DC_Throttle2: return TsCalMode::Tps2SecondaryMin;
149 default: return TsCalMode::None;
150 }
151}
@ Tps2SecondaryMin
@ Tps1SecondaryMin

Referenced by EtbImpl< TBase >::doAutocal().

Here is the caller graph for this function:

◆ functionToPositionSensor()

static SensorType functionToPositionSensor ( dc_function_e  func)
static

Definition at line 87 of file electronic_throttle.cpp.

87 {
88 switch(func) {
89 case DC_Throttle1: return SensorType::Tps1;
90 case DC_Throttle2: return SensorType::Tps2;
91 case DC_IdleValve: return SensorType::IdlePosition;
92 case DC_Wastegate: return SensorType::WastegatePosition;
93 default: return SensorType::Invalid;
94 }
95}

Referenced by EtbController::init().

Here is the caller graph for this function:

◆ functionToTpsSensor()

static SensorType functionToTpsSensor ( dc_function_e  func)
static

Definition at line 97 of file electronic_throttle.cpp.

97 {
98 switch(func) {
99 case DC_Throttle1: return SensorType::Tps1;
100 case DC_Throttle2: return SensorType::Tps2;
101 case DC_IdleValve: return SensorType::IdlePosition;
102 case DC_Wastegate: return SensorType::WastegatePosition;
103 default: return SensorType::Invalid;
104 }
105}

Referenced by EtbController::init().

Here is the caller graph for this function:

◆ functionToTpsSensorPrimary()

static SensorType functionToTpsSensorPrimary ( dc_function_e  func)
static

Definition at line 107 of file electronic_throttle.cpp.

107 {
108 switch(func) {
109 case DC_Throttle1: return SensorType::Tps1Primary;
110 case DC_Throttle2: return SensorType::Tps2Primary;
111 case DC_IdleValve: return SensorType::IdlePosition;
112 case DC_Wastegate: return SensorType::WastegatePosition;
113 default: return SensorType::Invalid;
114 }
115}

Referenced by EtbImpl< TBase >::doAutocal().

Here is the caller graph for this function:

◆ functionToTpsSensorSecondary()

static SensorType functionToTpsSensorSecondary ( dc_function_e  func)
static

Definition at line 117 of file electronic_throttle.cpp.

117 {
118 switch(func) {
119 case DC_Throttle1: return SensorType::Tps1Secondary;
120 case DC_Throttle2: return SensorType::Tps2Secondary;
121 /* No secondary sensors for Idle and EWG */
122 default: return SensorType::Invalid;
123 }
124}

Referenced by EtbImpl< TBase >::doAutocal().

Here is the caller graph for this function:

◆ getLiveData()

template<>
const electronic_throttle_s * getLiveData ( size_t  idx)

Definition at line 1095 of file electronic_throttle.cpp.

1095 {
1096#if EFI_ELECTRONIC_THROTTLE_BODY
1097 if (idx >= efi::size(etbControllers)) {
1098 return nullptr;
1099 }
1100
1101 return etbControllers[idx];
1102#else
1103 return nullptr;
1104#endif
1105}

◆ getPidForDcFunction()

static pid_s * getPidForDcFunction ( dc_function_e  function)
static

Definition at line 898 of file electronic_throttle.cpp.

Referenced by doInitElectronicThrottle().

Here is the caller graph for this function:

◆ getSanitizedPedal()

float getSanitizedPedal ( )

Definition at line 291 of file electronic_throttle.cpp.

291 {
292 auto pedalPosition = Sensor::get(SensorType::AcceleratorPedal);
293 // If the pedal has failed, just use 0 position.
294 // This is safer than disabling throttle control - we can at least push the throttle closed
295 // and let the engine idle.
296 return clampPercentValue(pedalPosition.value_or(0));
297}
virtual SensorResult get() const =0

Referenced by EtbController::getSetpointEtb().

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

◆ initElectronicThrottle()

void initElectronicThrottle ( )

Definition at line 963 of file electronic_throttle.cpp.

963 {
964 if (hasFirmwareError()) {
965 return;
966 }
967
968 for (int i = 0; i < ETB_COUNT; i++) {
970 }
971
972#if EFI_PROD_CODE
973 addConsoleAction("etbautocal", [](){
974 efiPrintf("etbAutocal invoked");
975 etbAutocal(DC_Throttle1);
976 });
977
978 addConsoleAction("etbinfo", [](){
979 efiPrintf("etbAutoTune=%d", engine->etbAutoTune);
980 efiPrintf("TPS=%.2f", Sensor::getOrZero(SensorType::Tps1));
981
982 efiPrintf("ETB1 duty=%.2f",
984
985 efiPrintf("ETB freq=%d",
987
988 for (int i = 0; i < ETB_COUNT; i++) {
989 efiPrintf("ETB%d", i);
990 efiPrintf(" dir1=%s", hwPortname(engineConfiguration->etbIo[i].directionPin1));
991 efiPrintf(" dir2=%s", hwPortname(engineConfiguration->etbIo[i].directionPin2));
992 efiPrintf(" control=%s", hwPortname(engineConfiguration->etbIo[i].controlPin));
993 efiPrintf(" disable=%s", hwPortname(engineConfiguration->etbIo[i].disablePin));
995 }
996 });
997
998#endif /* EFI_PROD_CODE */
999
1003
1004 doInitElectronicThrottle(/*isStartupInit*/true);
1005}
TunerStudioOutputChannels outputChannels
Definition engine.h:113
void initTable(TValueInit(&table)[TRowNum][TColNum], const TXColumnInit(&columnBins)[TColNum], const TRowInit(&rowBins)[TRowNum])
static float getOrZero(SensorType type)
Definition sensor.h:87
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
void showDcMotorInfo(int i)
void etbAutocal(dc_function_e function, bool reportToTs)
static Map3D< TRACTION_CONTROL_ETB_DROP_SLIP_SIZE, TRACTION_CONTROL_ETB_DROP_SPEED_SIZE, int8_t, uint16_t, uint8_t > tcEtbDropTable
static Map3D< ETB2_TRIM_RPM_SIZE, ETB2_TRIM_SIZE, int8_t, uint8_t, uint8_t > throttle2TrimTable
static pedal2tps_t pedal2tpsMap
void doInitElectronicThrottle(bool isStartupInit)
static constexpr persistent_config_s * config
const char * hwPortname(brain_pin_e brainPin)
uint8_t tractionControlSpeedBins[TRACTION_CONTROL_ETB_DROP_SPEED_SIZE]
scaled_channel< uint16_t, 100, 1 > tractionControlSlipBins[TRACTION_CONTROL_ETB_DROP_SLIP_SIZE]
int8_t tractionControlEtbDrop[TRACTION_CONTROL_ETB_DROP_SPEED_SIZE][TRACTION_CONTROL_ETB_DROP_SLIP_SIZE]
scaled_channel< int16_t, 100, 1 > etb1DutyCycle
uint8_t pedalToTpsTable[PEDAL_TO_TPS_SIZE][PEDAL_TO_TPS_RPM_SIZE]
scaled_channel< int8_t, 10, 1 > throttle2TrimTable[ETB2_TRIM_SIZE][ETB2_TRIM_RPM_SIZE]
scaled_channel< uint8_t, 1, 100 > throttle2TrimRpmBins[ETB2_TRIM_RPM_SIZE]
scaled_channel< uint8_t, 1, 100 > pedalToTpsRpmBins[PEDAL_TO_TPS_RPM_SIZE]

Referenced by commonInitEngineController().

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

◆ isBoardAllowingLackOfPps()

PUBLIC_API_WEAK bool isBoardAllowingLackOfPps ( )

Definition at line 166 of file electronic_throttle.cpp.

166 {
167 return false;
168}

Referenced by EtbController::checkStatus(), and EtbController::init().

Here is the caller graph for this function:

◆ onConfigurationChangeElectronicThrottleCallback()

void onConfigurationChangeElectronicThrottleCallback ( engine_configuration_s previousConfiguration)

Definition at line 874 of file electronic_throttle.cpp.

874 {
875 for (int i = 0; i < ETB_COUNT; i++) {
876 etbControllers[i]->onConfigurationChange(&previousConfiguration->etb);
877 }
878}
void onConfigurationChange(pid_s *previousConfiguration)

Referenced by incrementGlobalConfigurationVersion().

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

◆ pedal2TpsProvider()

PUBLIC_API_WEAK ValueProvider3D * pedal2TpsProvider ( )

Definition at line 905 of file electronic_throttle.cpp.

905 {
906 return &pedal2tpsMap;
907}

Referenced by doInitElectronicThrottle().

Here is the caller graph for this function:

◆ pickEtbOrStepper()

void pickEtbOrStepper ( )

Definition at line 1108 of file electronic_throttle.cpp.

1108 {
1110 return;
1111 }
1112 for (size_t i = 0;i<ETB_COUNT;i++) {
1113 if (engineConfiguration->etbFunctions[i] != DC_None) {
1114 criticalError("Cannot use H-bridge for stepper while DC function is selected");
1115 }
1116 }
1117}

Referenced by validateConfigOnStartUpOrBurn().

Here is the caller graph for this function:

◆ setBoschVAGETB()

void setBoschVAGETB ( )

Definition at line 819 of file electronic_throttle.cpp.

Referenced by commonPassatB6(), and hellen121_vag_boardDefaultConfiguration().

Here is the caller graph for this function:

◆ setBoschVNH2SP30Curve()

void setBoschVNH2SP30Curve ( )

Definition at line 832 of file electronic_throttle.cpp.

832 {
833 copyArray(config->etbBiasBins, boschBiasBins);
835}
static const float boschBiasValues[]
static const float boschBiasBins[]

Referenced by setEtbTestConfiguration().

Here is the caller graph for this function:

◆ setDefaultEtbBiasCurve()

void setDefaultEtbBiasCurve ( )

Definition at line 887 of file electronic_throttle.cpp.

887 {
892}
static const float defaultBiasValues[]
static const float defaultBiasBins[]
scaled_channel< int16_t, 100, 1 > dcWastegateBiasValues[ETB_BIAS_CURVE_LENGTH]

Referenced by setDefaultEngineConfiguration().

Here is the caller graph for this function:

◆ setDefaultEtbParameters()

void setDefaultEtbParameters ( )

Definition at line 837 of file electronic_throttle.cpp.

837 {
839
840 setLinearCurve(config->pedalToTpsPedalBins, /*from*/0, /*to*/100, 1);
842
843 for (int pedalIndex = 0;pedalIndex<PEDAL_TO_TPS_SIZE;pedalIndex++) {
844 for (int rpmIndex = 0;rpmIndex<PEDAL_TO_TPS_RPM_SIZE;rpmIndex++) {
845 config->pedalToTpsTable[pedalIndex][rpmIndex] = config->pedalToTpsPedalBins[pedalIndex];
846 }
847 }
848
849 // Default is to run each throttle off its respective hbridge
850 engineConfiguration->etbFunctions[0] = DC_Throttle1;
851 engineConfiguration->etbFunctions[1] = DC_Throttle2;
852
853 engineConfiguration->etbFreq = DEFAULT_ETB_PWM_FREQUENCY;
854
855 // voltage, not ADC like with TPS
856 setPPSCalibration(0, 5, 5, 0);
857
859 1, // Kp
860 10, // Ki
861 0.05, // Kd
862 0, // offset
863 0, // Update rate, unused
864 -100, 100 // min/max
865 };
866
869
871// engineConfiguration->etbJamTimeout = 1;
872}
void setPPSCalibration(float primaryUp, float primaryDown, float secondaryUp, float secondaryDown)
void setRpmTableBin(TValue(&array)[TSize])
void setLinearCurve(TValue(&array)[TSize], float from, float to, float precision=0.01f)

Referenced by setDefaultEngineConfiguration().

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

◆ setEtbIdlePosition()

void setEtbIdlePosition ( percent_t  pos)

Definition at line 1007 of file electronic_throttle.cpp.

1007 {
1008 for (int i = 0; i < ETB_COUNT; i++) {
1009 if (auto etb = engine->etbControllers[i]) {
1010 assertNotNullVoid(etb);
1011 etb->setIdlePosition(pos);
1012 }
1013 }
1014}

Referenced by applyIACposition().

Here is the caller graph for this function:

◆ setEtbLuaAdjustment()

void setEtbLuaAdjustment ( percent_t  pos)

Definition at line 1025 of file electronic_throttle.cpp.

1025 {
1026 for (int i = 0; i < ETB_COUNT; i++) {
1027 /* TODO: use from engine, add getFunction() to base class */
1028 //if (auto etb = engine->etbControllers[i]) {
1029 if (auto etb = etbControllers[i]) {
1030 assertNotNullVoid(etb);
1031 // try to adjust all ETB
1032 if (etb->getFunction() == DC_Throttle1 || etb->getFunction() == DC_Throttle2) {
1033 etb->setLuaAdjustment(pos);
1034 }
1035 }
1036 }
1037}

Referenced by configureRusefiLuaHooks().

Here is the caller graph for this function:

◆ setEtbWastegatePosition()

void setEtbWastegatePosition ( percent_t  pos)

Definition at line 1016 of file electronic_throttle.cpp.

1016 {
1017 for (int i = 0; i < ETB_COUNT; i++) {
1018 if (auto etb = engine->etbControllers[i]) {
1019 assertNotNullVoid(etb);
1020 etb->setWastegatePosition(pos);
1021 }
1022 }
1023}

Referenced by BoostController::setOutput().

Here is the caller graph for this function:

◆ setEwgLuaAdjustment()

void setEwgLuaAdjustment ( percent_t  pos)

Definition at line 1039 of file electronic_throttle.cpp.

1039 {
1040 for (int i = 0; i < ETB_COUNT; i++) {
1041 /* TODO: use from engine, add getFunction() to base class */
1042 //if (auto etb = engine->etbControllers[i]) {
1043 if (auto etb = etbControllers[i]) {
1044 assertNotNullVoid(etb);
1045 // try to adjust all ETB
1046 if (etb->getFunction() == DC_Wastegate) {
1047 etb->setLuaAdjustment(pos);
1048 }
1049 }
1050 }
1051}

Referenced by configureRusefiLuaHooks().

Here is the caller graph for this function:

◆ setHitachiEtbBiasBins()

void setHitachiEtbBiasBins ( )

Definition at line 82 of file electronic_throttle.cpp.

82 {
85}
static const float hardCodedetbHitachiBiasValues[8]
static const float hardCodedetbHitachiBiasBins[8]

Referenced by setHitachiEtbCalibration().

Here is the caller graph for this function:

◆ setHitachiEtbCalibration()

void setHitachiEtbCalibration ( )

Definition at line 1057 of file electronic_throttle.cpp.

1057 {
1059
1061
1069
1070 // Nissan 60mm throttle
1075}
void setToyota89281_33010_pedal_position_sensor()
void setHitachiEtbBiasBins()

Referenced by setProteusHitachiEtbDefaults().

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

◆ setProteusHitachiEtbDefaults()

void setProteusHitachiEtbDefaults ( )

Definition at line 1077 of file electronic_throttle.cpp.

1077 {
1078#if HW_PROTEUS
1080
1081 // EFI_ADC_12: "Analog Volt 3"
1082 engineConfiguration->tps1_2AdcChannel = PROTEUS_IN_TPS1_2;
1083 // EFI_ADC_13: "Analog Volt 4"
1084 engineConfiguration->tps2_1AdcChannel = PROTEUS_IN_TPS2_1;
1085 // EFI_ADC_0: "Analog Volt 5"
1086 engineConfiguration->tps2_2AdcChannel = PROTEUS_IN_ANALOG_VOLT_5;
1087 setPPSInputs(PROTEUS_IN_ANALOG_VOLT_6, PROTEUS_IN_PPS2);
1088#endif // HW_PROTEUS
1089}
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2)
void setHitachiEtbCalibration()

Referenced by setEngineBMW_M73_Proteus().

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

◆ setToyota89281_33010_pedal_position_sensor()

void setToyota89281_33010_pedal_position_sensor ( )

Definition at line 1053 of file electronic_throttle.cpp.

1053 {
1054 setPPSCalibration(0, 4.1, 0.73, 4.9);
1055}

Referenced by setHitachiEtbCalibration().

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

◆ unregisterEtbPins()

void unregisterEtbPins ( )

Definition at line 894 of file electronic_throttle.cpp.

894 {
895 // todo: we probably need an implementation here?!
896}

Referenced by EnginePins::unregisterPins().

Here is the caller graph for this function:

Variable Documentation

◆ boschBiasBins

const float boschBiasBins[]
static
Initial value:
= {
0, 1, 5, 7, 14, 65, 66, 100
}

This specific throttle has default position of about 7% open

Definition at line 812 of file electronic_throttle.cpp.

812 {
813 0, 1, 5, 7, 14, 65, 66, 100
814};

Referenced by setBoschVNH2SP30Curve().

◆ boschBiasValues

const float boschBiasValues[]
static
Initial value:
= {
-15, -15, -10, 0, 19, 20, 26, 28
}

Definition at line 815 of file electronic_throttle.cpp.

815 {
816 -15, -15, -10, 0, 19, 20, 26, 28
817};

Referenced by setBoschVNH2SP30Curve().

◆ CCM_OPTIONAL

DcThread dcThread CCM_OPTIONAL
static

Definition at line 758 of file electronic_throttle.cpp.

◆ defaultBiasBins

const float defaultBiasBins[]
static
Initial value:
= {
0, 1, 2, 4, 7, 98, 99, 100
}

Definition at line 880 of file electronic_throttle.cpp.

880 {
881 0, 1, 2, 4, 7, 98, 99, 100
882};

Referenced by proteusLuaDemo(), and setDefaultEtbBiasCurve().

◆ defaultBiasValues

const float defaultBiasValues[]
static
Initial value:
= {
-20, -18, -17, 0, 20, 21, 22, 25
}

Definition at line 883 of file electronic_throttle.cpp.

883 {
884 -20, -18, -17, 0, 20, 21, 22, 25
885};

Referenced by proteusLuaDemo(), and setDefaultEtbBiasCurve().

◆ ebtResetCounter

int ebtResetCounter

Definition at line 220 of file electronic_throttle.cpp.

Referenced by etbPidReset(), and EtbController::reset().

◆ etb1

Things running on a timer (instead of a thread) don't participate it the RTOS's thread priority system, and operate essentially "first come first serve", which risks starvation. Since ETB is a safety critical device, we need the hard RTOS guarantee that it will be scheduled over other less important tasks.

Definition at line 727 of file electronic_throttle.cpp.

◆ etb2

◆ etbControllers

EtbController* etbControllers[] = { &etb1, &etb2 }
static

◆ etbPeriodSeconds

constexpr float etbPeriodSeconds = 1.0f / ETB_LOOP_FREQUENCY
constexpr

Definition at line 71 of file electronic_throttle.cpp.

Referenced by EtbController::init().

◆ hardCodedetbHitachiBiasBins

const float hardCodedetbHitachiBiasBins[8] = {0.0, 19.0, 21.0, 22.0, 23.0, 25.0, 30.0, 100.0}
static

Definition at line 77 of file electronic_throttle.cpp.

77{0.0, 19.0, 21.0, 22.0, 23.0, 25.0, 30.0, 100.0};

Referenced by setHitachiEtbBiasBins().

◆ hardCodedetbHitachiBiasValues

const float hardCodedetbHitachiBiasValues[8] = {-18.0, -17.0, -15.0, 0.0, 16.0, 20.0, 20.0, 20.0}
static

Definition at line 79 of file electronic_throttle.cpp.

79{-18.0, -17.0, -15.0, 0.0, 16.0, 20.0, 20.0, 20.0};

Referenced by setHitachiEtbBiasBins().

◆ pedal2tpsMap

pedal2tps_t pedal2tpsMap {"p2t"}
static

Definition at line 67 of file electronic_throttle.cpp.

67{"p2t"};

Referenced by initElectronicThrottle(), and pedal2TpsProvider().

◆ tcEtbDropTable

Map3D<TRACTION_CONTROL_ETB_DROP_SLIP_SIZE, TRACTION_CONTROL_ETB_DROP_SPEED_SIZE, int8_t, uint16_t, uint8_t> tcEtbDropTable {"tce"}
static

Definition at line 69 of file electronic_throttle.cpp.

69{"tce"};

Referenced by EtbController::getSetpointEtb(), and initElectronicThrottle().

◆ throttle2TrimTable

Map3D<ETB2_TRIM_RPM_SIZE, ETB2_TRIM_SIZE, int8_t, uint8_t, uint8_t> throttle2TrimTable {"t2t"}
static

Definition at line 68 of file electronic_throttle.cpp.

68{"t2t"};

Referenced by initElectronicThrottle().

Go to the source code of this file.