hysteresis for GPPWM #3222

This commit is contained in:
rusefillc 2021-09-05 20:16:57 -04:00
parent d22f7e0927
commit 58c2bf8930
2 changed files with 7 additions and 2 deletions

View File

@ -46,6 +46,11 @@ 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) {
firmwareError(CUSTOM_ERR_6122, "You can't have off below %f greater than on above %f",
m_config->offBelowDuty,
m_config->onBelowDuty);
}
// Apply hysteresis with provided values
if (m_state && result < m_config->offBelowDuty) {
m_state = false;

View File

@ -346,8 +346,8 @@ struct gppwm_channel
uint8_t dutyIfError;+If an error (with a sensor, etc) is detected, this value is used instead of reading from the table.\nThis should be a safe value for whatever hardware is connected to prevent damage.;"%", 1, 0, 0, 100, 0
uint16_t pwmFrequency;+Select a frequency to run PWM at.\nSet this to 0hz to enable on-off mode.;"hz", 1, 0, 0, 500, 0
uint8_t onAboveDuty;+In on-off mode, turn the output on when the table value is above this duty.;"%", 1, 0, 0, 100, 0
uint8_t offBelowDuty;+In on-off mode, turn the output off when the table value is below this duty.;"%", 1, 0, 0, 100, 0
uint8_t onAboveDuty;+Hysteresis: in on-off mode, turn the output on when the table value is above this duty.;"%", 1, 0, 0, 100, 0
uint8_t offBelowDuty;+Hysteresis: in on-off mode, turn the output off when the table value is below this duty.;"%", 1, 0, 0, 100, 0
gppwm_channel_e loadAxis;+Selects the load axis to use for the table.;
uint8_t alignmentFill_map;;"unit", 1, 0, 0, 100, 0