hysteresis for GPPWM #3222

This commit is contained in:
rusefillc 2021-09-06 07:21:17 -04:00
parent 1bcd9ca6a9
commit 43bdabeb0c
1 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,8 @@
#include "table_helper.h"
#include "expected.h"
#define EPS3 0.001
expected<float> 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);