dual ETB seems to work!
This commit is contained in:
parent
76ca1aacb7
commit
e2074388ff
|
@ -741,7 +741,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
tsOutputChannels->vBatt = getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
// offset 32
|
||||
tsOutputChannels->tpsADC = getTPS12bitAdc(PASS_ENGINE_PARAMETER_SIGNATURE) / TPS_TS_CONVERSION;
|
||||
tsOutputChannels->tpsADC = getTPS12bitAdc(0 PASS_ENGINE_PARAMETER_SUFFIX) / TPS_TS_CONVERSION;
|
||||
// offset 36
|
||||
#if EFI_ANALOG_SENSORS
|
||||
tsOutputChannels->baroPressure = hasBaroSensor() ? getBaroPressure() : 0;
|
||||
|
|
|
@ -180,11 +180,11 @@ static percent_t currentEtbDuty;
|
|||
// this macro clamps both positive and negative percentages from about -100% to 100%
|
||||
#define ETB_PERCENT_TO_DUTY(X) (maxF(minF((X * 0.01), ETB_DUTY_LIMIT - 0.01), 0.01 - ETB_DUTY_LIMIT))
|
||||
|
||||
void EtbController::init(DcMotor *motor) {
|
||||
void EtbController::init(DcMotor *motor, int ownIndex) {
|
||||
this->m_motor = motor;
|
||||
this->ownIndex = ownIndex;
|
||||
}
|
||||
|
||||
|
||||
int EtbController::getPeriodMs() {
|
||||
return GET_PERIOD_LIMITED(&engineConfiguration->etb);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ void EtbController::PeriodicTask() {
|
|||
return;
|
||||
}
|
||||
|
||||
percent_t actualThrottlePosition = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
percent_t actualThrottlePosition = getTPSWithIndex(ownIndex PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
if (engine->etbAutoTune) {
|
||||
autoTune.input = actualThrottlePosition;
|
||||
|
@ -639,7 +639,7 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
etbController[i].init(&etbHardware[i].dcMotor);
|
||||
etbController[i].init(&etbHardware[i].dcMotor, i);
|
||||
etbController[i].etbPid.initPidClass(&engineConfiguration->etb);
|
||||
INJECT_ENGINE_REFERENCE(etbController[i]);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class DcMotor;
|
|||
class EtbController final : public PeriodicTimerController {
|
||||
public:
|
||||
DECLARE_ENGINE_PTR;
|
||||
void init(DcMotor *motor);
|
||||
void init(DcMotor *motor, int ownIndex);
|
||||
|
||||
int getPeriodMs() override;
|
||||
void PeriodicTask() override;
|
||||
|
@ -31,6 +31,7 @@ public:
|
|||
bool shouldResetPid = false;
|
||||
|
||||
private:
|
||||
int ownIndex;
|
||||
DcMotor *m_motor;
|
||||
};
|
||||
|
||||
|
|
|
@ -819,6 +819,6 @@ int getRusEfiVersion(void) {
|
|||
if (initBootloader() != 0)
|
||||
return 123;
|
||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||
return 20191128;
|
||||
return 20191129;
|
||||
}
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
|
|
@ -141,7 +141,7 @@ float getTPSVoltage(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
* We need ADC value because TunerStudio has a nice TPS configuration wizard, and this wizard
|
||||
* wants a TPS value.
|
||||
*/
|
||||
int getTPS12bitAdc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
int getTPS12bitAdc(int index PASS_ENGINE_PARAMETER_SUFFIX) {
|
||||
#if !EFI_PROD_CODE
|
||||
if (engine->mockTpsAdcValue != MOCK_UNDEFINED) {
|
||||
return engine->mockTpsAdcValue;
|
||||
|
@ -151,7 +151,11 @@ int getTPS12bitAdc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
return -1;
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
return getAdcValue("tps10", engineConfiguration->tps1_1AdcChannel);
|
||||
if (index == 0) {
|
||||
return getAdcValue("tps10", engineConfiguration->tps1_1AdcChannel);
|
||||
} else {
|
||||
return getAdcValue("tps20", engineConfiguration->tps2_1AdcChannel);
|
||||
}
|
||||
// return tpsFastAdc / 4;
|
||||
#else
|
||||
return 0;
|
||||
|
@ -193,8 +197,8 @@ void grabPedalIsWideOpen() {
|
|||
/**
|
||||
* @brief Position on physical primary TPS
|
||||
*/
|
||||
static percent_t getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
percent_t tpsValue = getTpsValue(getTPS12bitAdc(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
static percent_t getPrimatyRawTPS(int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
percent_t tpsValue = getTpsValue(getTPS12bitAdc(index PASS_ENGINE_PARAMETER_SUFFIX) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
return tpsValue;
|
||||
}
|
||||
|
||||
|
@ -222,7 +226,7 @@ bool hasTpsSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
return engineConfiguration->tps1_1AdcChannel != EFI_ADC_NONE;
|
||||
}
|
||||
|
||||
percent_t getTPS(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
percent_t getTPSWithIndex(int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
#if !EFI_PROD_CODE
|
||||
if (!cisnan(engine->mockTpsValue)) {
|
||||
return engine->mockTpsValue;
|
||||
|
@ -234,7 +238,11 @@ percent_t getTPS(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
// todo: blah blah
|
||||
// todo: if two TPS do not match - show OBD code via malfunction_central.c
|
||||
|
||||
return getPrimatyRawTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
return getPrimatyRawTPS(index PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
percent_t getTPS(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
return getTPSWithIndex(0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
void setBosch0280750009(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
|
|
@ -24,9 +24,10 @@ percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|||
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
|
||||
*/
|
||||
percent_t getTPS(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
percent_t getTPSWithIndex(int index DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
bool hasTpsSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
int convertVoltageTo10bitADC(float voltage);
|
||||
int getTPS12bitAdc(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
int getTPS12bitAdc(int index PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#define getTPS10bitAdc() (getTPS12bitAdc() / TPS_TS_CONVERSION)
|
||||
float getTPSVoltage(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
|
Loading…
Reference in New Issue