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://github.com/rusefi/rusefi/wiki/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)
 
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)
 

Variables

static pedal2tps_t pedal2tpsMap {"p2t"}
 
static Map3D< ETB2_TRIM_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:296
static EtbController * etbControllers[]
static EngineAccessor engine
Definition engine.h:413
etbErrorCode("etbErrorCode", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1864, 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 898 of file electronic_throttle.cpp.

898 {
899 bool anyEtbConfigured = false;
900
901 // todo: technical debt: we still have DC motor code initialization in ETB-specific file while DC motors are used not just as ETB
902 // like DC motor wastegate code flow should probably NOT go through electronic_throttle.cpp right?
903 // todo: rename etbFunctions to something-without-etb for same reason?
904 for (int i = 0 ; i < ETB_COUNT; i++) {
905 auto func = engineConfiguration->etbFunctions[i];
906 if (func == DC_None) {
907 // do not touch HW pins if function not selected, this way Lua can use DC motor hardware pins directly
908 continue;
909 }
910 auto motor = initDcMotor("ETB disable",
912
913 auto controller = engine->etbControllers[i];
914 criticalAssertVoid(controller != nullptr, "null ETB");
915
916 auto pid = getPidForDcFunction(func);
917
918 bool dcConfigured = controller->init(func, motor, pid, pedal2TpsProvider());
919 if (isStartupInit && dcConfigured) {
920 controller->reset("init");
921 }
922 anyEtbConfigured |= dcConfigured && controller->isEtbMode();
923 }
924
925 // It's not valid to have a PPS without any ETBs - check that at least one ETB was enabled along with the pedal
926 if (!anyEtbConfigured && Sensor::hasSensor(SensorType::AcceleratorPedalPrimary)) {
927 criticalError("A pedal position sensor was configured, but no electronic throttles are configured.");
928 }
929
930#if 0 && ! EFI_UNIT_TEST
931 percent_t startupThrottlePosition = getTPS();
932 if (std::abs(startupThrottlePosition - engineConfiguration->etbNeutralPosition) > STARTUP_NEUTRAL_POSITION_ERROR_THRESHOLD) {
933 /**
934 * Unexpected electronic throttle start-up position is worth a critical error
935 */
937 startupThrottlePosition,
939 startupPositionError = true;
940 }
941#endif /* EFI_UNIT_TEST */
942
943#if !EFI_UNIT_TEST
944 static bool started = false;
945 if (started == false) {
946 dcThread.start();
947 started = true;
948 }
949#endif
950}
IEtbController * etbControllers[ETB_COUNT]
Definition engine.h:126
virtual bool hasSensor() const
Definition sensor.h:141
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:

◆ etbGetState()

EtbStatus etbGetState ( size_t  throttleIndex)

Definition at line 789 of file electronic_throttle.cpp.

790{
791 if (throttleIndex >= ETB_COUNT) {
793 }
794
795 return (EtbStatus)etbControllers[throttleIndex]->etbErrorCode;
796}
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 1084 of file electronic_throttle.cpp.

1084 {
1085#if EFI_ELECTRONIC_THROTTLE_BODY
1086 if (idx >= efi::size(etbControllers)) {
1087 return nullptr;
1088 }
1089
1090 return etbControllers[idx];
1091#else
1092 return nullptr;
1093#endif
1094}

◆ getPidForDcFunction()

static pid_s * getPidForDcFunction ( dc_function_e  function)
static

Definition at line 887 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 952 of file electronic_throttle.cpp.

952 {
953 if (hasFirmwareError()) {
954 return;
955 }
956
957 for (int i = 0; i < ETB_COUNT; i++) {
959 }
960
961#if EFI_PROD_CODE
962 addConsoleAction("etbautocal", [](){
963 efiPrintf("etbAutocal invoked");
964 etbAutocal(DC_Throttle1);
965 });
966
967 addConsoleAction("etbinfo", [](){
968 efiPrintf("etbAutoTune=%d", engine->etbAutoTune);
969 efiPrintf("TPS=%.2f", Sensor::getOrZero(SensorType::Tps1));
970
971 efiPrintf("ETB1 duty=%.2f",
973
974 efiPrintf("ETB freq=%d",
976
977 for (int i = 0; i < ETB_COUNT; i++) {
978 efiPrintf("ETB%d", i);
979 efiPrintf(" dir1=%s", hwPortname(engineConfiguration->etbIo[i].directionPin1));
980 efiPrintf(" dir2=%s", hwPortname(engineConfiguration->etbIo[i].directionPin2));
981 efiPrintf(" control=%s", hwPortname(engineConfiguration->etbIo[i].controlPin));
982 efiPrintf(" disable=%s", hwPortname(engineConfiguration->etbIo[i].disablePin));
984 }
985 });
986
987#endif /* EFI_PROD_CODE */
988
992
993 doInitElectronicThrottle(/*isStartupInit*/true);
994}
TunerStudioOutputChannels outputChannels
Definition engine.h:109
void initTable(TValueInit(&table)[TRowNum][TColNum], const TXColumnInit(&columnBins)[TColNum], const TRowInit(&rowBins)[TRowNum])
static float getOrZero(SensorType type)
Definition sensor.h:83
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_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_SLIP_SIZE][TRACTION_CONTROL_ETB_DROP_SPEED_SIZE]
scaled_channel< int16_t, 100, 1 > etb1DutyCycle
uint8_t pedalToTpsTable[PEDAL_TO_TPS_SIZE][PEDAL_TO_TPS_RPM_SIZE]
scaled_channel< uint8_t, 1, 100 > throttle2TrimRpmBins[ETB2_TRIM_SIZE]
scaled_channel< uint8_t, 1, 100 > pedalToTpsRpmBins[PEDAL_TO_TPS_RPM_SIZE]
scaled_channel< int8_t, 10, 1 > throttle2TrimTable[ETB2_TRIM_SIZE][ETB2_TRIM_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 863 of file electronic_throttle.cpp.

863 {
864 for (int i = 0; i < ETB_COUNT; i++) {
865 etbControllers[i]->onConfigurationChange(&previousConfiguration->etb);
866 }
867}
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 894 of file electronic_throttle.cpp.

894 {
895 return &pedal2tpsMap;
896}

Referenced by doInitElectronicThrottle().

Here is the caller graph for this function:

◆ setBoschVAGETB()

void setBoschVAGETB ( )

Definition at line 808 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 821 of file electronic_throttle.cpp.

821 {
822 copyArray(config->etbBiasBins, boschBiasBins);
824}
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 876 of file electronic_throttle.cpp.

876 {
881}
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 826 of file electronic_throttle.cpp.

826 {
828
829 setLinearCurve(config->pedalToTpsPedalBins, /*from*/0, /*to*/100, 1);
831
832 for (int pedalIndex = 0;pedalIndex<PEDAL_TO_TPS_SIZE;pedalIndex++) {
833 for (int rpmIndex = 0;rpmIndex<PEDAL_TO_TPS_RPM_SIZE;rpmIndex++) {
834 config->pedalToTpsTable[pedalIndex][rpmIndex] = config->pedalToTpsPedalBins[pedalIndex];
835 }
836 }
837
838 // Default is to run each throttle off its respective hbridge
839 engineConfiguration->etbFunctions[0] = DC_Throttle1;
840 engineConfiguration->etbFunctions[1] = DC_Throttle2;
841
842 engineConfiguration->etbFreq = DEFAULT_ETB_PWM_FREQUENCY;
843
844 // voltage, not ADC like with TPS
845 setPPSCalibration(0, 5, 5, 0);
846
848 1, // Kp
849 10, // Ki
850 0.05, // Kd
851 0, // offset
852 0, // Update rate, unused
853 -100, 100 // min/max
854 };
855
858
860// engineConfiguration->etbJamTimeout = 1;
861}
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 996 of file electronic_throttle.cpp.

996 {
997 for (int i = 0; i < ETB_COUNT; i++) {
998 if (auto etb = engine->etbControllers[i]) {
999 assertNotNullVoid(etb);
1000 etb->setIdlePosition(pos);
1001 }
1002 }
1003}

Referenced by applyIACposition().

Here is the caller graph for this function:

◆ setEtbLuaAdjustment()

void setEtbLuaAdjustment ( percent_t  pos)

Definition at line 1014 of file electronic_throttle.cpp.

1014 {
1015 for (int i = 0; i < ETB_COUNT; i++) {
1016 /* TODO: use from engine, add getFunction() to base class */
1017 //if (auto etb = engine->etbControllers[i]) {
1018 if (auto etb = etbControllers[i]) {
1019 assertNotNullVoid(etb);
1020 // try to adjust all ETB
1021 if (etb->getFunction() == DC_Throttle1 || etb->getFunction() == DC_Throttle2) {
1022 etb->setLuaAdjustment(pos);
1023 }
1024 }
1025 }
1026}

Referenced by configureRusefiLuaHooks().

Here is the caller graph for this function:

◆ setEtbWastegatePosition()

void setEtbWastegatePosition ( percent_t  pos)

Definition at line 1005 of file electronic_throttle.cpp.

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

Referenced by BoostController::setOutput().

Here is the caller graph for this function:

◆ setEwgLuaAdjustment()

void setEwgLuaAdjustment ( percent_t  pos)

Definition at line 1028 of file electronic_throttle.cpp.

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

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 1046 of file electronic_throttle.cpp.

1046 {
1048
1050
1058
1059 // Nissan 60mm throttle
1064}
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 1066 of file electronic_throttle.cpp.

1066 {
1067#if HW_PROTEUS
1069
1070 // EFI_ADC_12: "Analog Volt 3"
1071 engineConfiguration->tps1_2AdcChannel = PROTEUS_IN_TPS1_2;
1072 // EFI_ADC_13: "Analog Volt 4"
1073 engineConfiguration->tps2_1AdcChannel = PROTEUS_IN_TPS2_1;
1074 // EFI_ADC_0: "Analog Volt 5"
1075 engineConfiguration->tps2_2AdcChannel = PROTEUS_IN_ANALOG_VOLT_5;
1076 setPPSInputs(PROTEUS_IN_ANALOG_VOLT_6, PROTEUS_IN_PPS2);
1077#endif // HW_PROTEUS
1078}
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 1042 of file electronic_throttle.cpp.

1042 {
1043 setPPSCalibration(0, 4.1, 0.73, 4.9);
1044}

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 883 of file electronic_throttle.cpp.

883 {
884 // todo: we probably need an implementation here?!
885}

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 801 of file electronic_throttle.cpp.

801 {
802 0, 1, 5, 7, 14, 65, 66, 100
803};

Referenced by setBoschVNH2SP30Curve().

◆ boschBiasValues

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

Definition at line 804 of file electronic_throttle.cpp.

804 {
805 -15, -15, -10, 0, 19, 20, 26, 28
806};

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 869 of file electronic_throttle.cpp.

869 {
870 0, 1, 2, 4, 7, 98, 99, 100
871};

Referenced by proteusLuaDemo(), and setDefaultEtbBiasCurve().

◆ defaultBiasValues

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

Definition at line 872 of file electronic_throttle.cpp.

872 {
873 -20, -18, -17, 0, 20, 21, 22, 25
874};

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

Definition at line 730 of file electronic_throttle.cpp.

730{ &etb1, &etb2 };
EtbImpl< EtbController2 > etb2(throttle2TrimTable)
EtbImpl< EtbController1 > etb1

Referenced by blinkEtbErrorCodes(), etbAutocal(), etbGetState(), getLiveData(), initElectronicThrottle(), onConfigurationChangeElectronicThrottleCallback(), setEtbLuaAdjustment(), and setEwgLuaAdjustment().

◆ 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_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.