From 43bdabeb0c8eceff7a0b3212f29e2c072c4619af Mon Sep 17 00:00:00 2001 From: rusefillc Date: Mon, 6 Sep 2021 07:21:17 -0400 Subject: [PATCH] hysteresis for GPPWM #3222 --- firmware/controllers/actuators/gppwm/gppwm_channel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/actuators/gppwm/gppwm_channel.cpp b/firmware/controllers/actuators/gppwm/gppwm_channel.cpp index 4386af4aa2..9fae2faca6 100644 --- a/firmware/controllers/actuators/gppwm/gppwm_channel.cpp +++ b/firmware/controllers/actuators/gppwm/gppwm_channel.cpp @@ -6,6 +6,8 @@ #include "table_helper.h" #include "expected.h" +#define EPS3 0.001 + expected readGppwmChannel(gppwm_channel_e channel DECLARE_ENGINE_PARAMETER_SUFFIX) { switch (channel) { case GPPWM_Tps: @@ -46,7 +48,7 @@ void GppwmChannel::setOutput(float result) { m_pwm->setSimplePwmDutyCycle(clampF(0, result / 100.0f, 1)); } else { efiAssertVoid(OBD_PCM_Processor_Fault, m_output, "m_output null"); - if (m_config->offBelowDuty > m_config->onAboveDuty) { + if (m_config->offBelowDuty - m_config->onAboveDuty > EPS3) { firmwareError(CUSTOM_ERR_6122, "You can't have off below %f greater than on above %f", m_config->offBelowDuty, m_config->onAboveDuty);