This commit is contained in:
Matthew Kennedy 2020-10-18 17:49:42 -07:00 committed by GitHub
parent 44653da2e5
commit ee5d0bf07b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 20 deletions

View File

@ -593,7 +593,7 @@ struct EtbThread final : public PeriodicController<512> {
void PeriodicTask(efitick_t) override { void PeriodicTask(efitick_t) override {
// Simply update all controllers // Simply update all controllers
for (int i = 0 ; i < engine->etbActualCount; i++) { for (int i = 0 ; i < ETB_COUNT; i++) {
etbControllers[i].update(); etbControllers[i].update();
} }
} }
@ -605,10 +605,6 @@ static EtbThread etbThread;
static void showEthInfo(void) { static void showEthInfo(void) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
if (engine->etbActualCount == 0) {
scheduleMsg(&logger, "ETB DISABLED since no PPS");
}
scheduleMsg(&logger, "etbAutoTune=%d", scheduleMsg(&logger, "etbAutoTune=%d",
engine->etbAutoTune); engine->etbAutoTune);
@ -619,8 +615,8 @@ static void showEthInfo(void) {
hwPortname(CONFIG(etbIo[0].controlPin1)), hwPortname(CONFIG(etbIo[0].controlPin1)),
currentEtbDuty, currentEtbDuty,
engineConfiguration->etbFreq); engineConfiguration->etbFreq);
int i;
for (i = 0; i < engine->etbActualCount; i++) { for (int i = 0; i < ETB_COUNT; i++) {
scheduleMsg(&logger, "ETB%d", i); scheduleMsg(&logger, "ETB%d", i);
scheduleMsg(&logger, " dir1=%s", hwPortname(CONFIG(etbIo[i].directionPin1))); scheduleMsg(&logger, " dir1=%s", hwPortname(CONFIG(etbIo[i].directionPin1)));
scheduleMsg(&logger, " dir2=%s", hwPortname(CONFIG(etbIo[i].directionPin2))); scheduleMsg(&logger, " dir2=%s", hwPortname(CONFIG(etbIo[i].directionPin2)));
@ -633,8 +629,11 @@ static void showEthInfo(void) {
} }
static void etbPidReset(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void etbPidReset(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
for (int i = 0 ; i < engine->etbActualCount; i++) { for (int i = 0 ; i < ETB_COUNT; i++) {
engine->etbControllers[i]->reset(); if (auto controller = engine->etbControllers[i]) {
controller->reset();
}
} }
} }
@ -655,7 +654,7 @@ void setThrottleDutyCycle(percent_t level) {
float dc = ETB_PERCENT_TO_DUTY(level); float dc = ETB_PERCENT_TO_DUTY(level);
directPwmValue = dc; directPwmValue = dc;
for (int i = 0 ; i < engine->etbActualCount; i++) { for (int i = 0 ; i < ETB_COUNT; i++) {
setDcMotorDuty(i, dc); setDcMotorDuty(i, dc);
} }
scheduleMsg(&logger, "duty ETB duty=%f", dc); scheduleMsg(&logger, "duty ETB duty=%f", dc);
@ -664,7 +663,7 @@ void setThrottleDutyCycle(percent_t level) {
static void setEtbFrequency(int frequency) { static void setEtbFrequency(int frequency) {
engineConfiguration->etbFreq = frequency; engineConfiguration->etbFreq = frequency;
for (int i = 0 ; i < engine->etbActualCount; i++) { for (int i = 0 ; i < ETB_COUNT; i++) {
setDcMotorFrequency(i, frequency); setDcMotorFrequency(i, frequency);
} }
} }
@ -672,7 +671,7 @@ static void setEtbFrequency(int frequency) {
static void etbReset() { static void etbReset() {
scheduleMsg(&logger, "etbReset"); scheduleMsg(&logger, "etbReset");
for (int i = 0 ; i < engine->etbActualCount; i++) { for (int i = 0 ; i < ETB_COUNT; i++) {
setDcMotorDuty(i, 0); setDcMotorDuty(i, 0);
} }
@ -830,9 +829,6 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins); pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins);
// TODO: remove etbActualCount
engine->etbActualCount = ETB_COUNT;
bool mustHaveEtbConfigured = Sensor::hasSensor(SensorType::AcceleratorPedalPrimary); bool mustHaveEtbConfigured = Sensor::hasSensor(SensorType::AcceleratorPedalPrimary);
bool anyEtbConfigured = false; bool anyEtbConfigured = false;

View File

@ -120,11 +120,6 @@ public:
bool applyLaunchControlRetard = false; bool applyLaunchControlRetard = false;
#endif /* EFI_LAUNCH_CONTROL */ #endif /* EFI_LAUNCH_CONTROL */
/**
* if 2nd TPS is not configured we do not run 2nd ETB
*/
int etbActualCount = 0;
/** /**
* By the way 32-bit value should hold at least 400 hours of events at 6K RPM x 12 events per revolution * By the way 32-bit value should hold at least 400 hours of events at 6K RPM x 12 events per revolution
*/ */