ETB duty cycle jitter #4833
This commit is contained in:
parent
73e309da03
commit
8a3727de3e
|
@ -215,6 +215,9 @@ bool EtbController::init(etb_function_e function, DcMotor *motor, pid_s *pidPara
|
|||
|
||||
void EtbController::reset() {
|
||||
m_shouldResetPid = true;
|
||||
etbDutyRateOfChange = etbDutyAverage = 0;
|
||||
m_dutyRocAverage.reset();
|
||||
m_dutyAverage.reset();
|
||||
}
|
||||
|
||||
void EtbController::onConfigurationChange(pid_s* previousConfiguration) {
|
||||
|
@ -740,12 +743,11 @@ static void showEtbInfo() {
|
|||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
static void etbPidReset() {
|
||||
void etbPidReset() {
|
||||
for (int i = 0 ; i < ETB_COUNT; i++) {
|
||||
if (auto controller = engine->etbControllers[i]) {
|
||||
controller->reset();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,6 +119,8 @@ private:
|
|||
Timer m_luaAdjustmentTimer;
|
||||
};
|
||||
|
||||
void etbPidReset();
|
||||
|
||||
class EtbController1 : public EtbController { };
|
||||
|
||||
class EtbController2 : public EtbController {
|
||||
|
|
|
@ -15,6 +15,11 @@ public:
|
|||
smoothingFactor = 2 / (length + 1.0);
|
||||
}
|
||||
|
||||
void reset() {
|
||||
current = 0;
|
||||
smoothingFactor = 0.5;
|
||||
}
|
||||
|
||||
private:
|
||||
float current = 0;
|
||||
float smoothingFactor = 0.5;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
TEST(etb, integrated) {
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
etbPidReset(); // ETB controlles are global shared instances :(
|
||||
|
||||
engineConfiguration->tps1_1AdcChannel = EFI_ADC_3;
|
||||
engineConfiguration->tps1_2AdcChannel = EFI_ADC_3;
|
||||
|
@ -17,15 +18,12 @@ TEST(etb, integrated) {
|
|||
|
||||
Sensor::setMockValue(SensorType::Tps1, 25.0f, true);
|
||||
|
||||
|
||||
initTps();
|
||||
doInitElectronicThrottle();
|
||||
|
||||
EtbController *etb = (EtbController*)engine->etbControllers[0];
|
||||
etb->update();
|
||||
|
||||
|
||||
|
||||
ASSERT_EQ(engine->outputChannels.etbTarget, 40);
|
||||
ASSERT_EQ(etb->prevOutput, 100);
|
||||
ASSERT_EQ(etb->etbDutyAverage, 50);
|
||||
|
|
Loading…
Reference in New Issue