CJ125 heater zero PWM improvement
This commit is contained in:
parent
905db38c17
commit
56f0260414
|
@ -75,6 +75,15 @@ void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
|
||||||
warning(CUSTOM_ERR_6579, "spwd:dutyCycle %.2f", dutyCycle);
|
warning(CUSTOM_ERR_6579, "spwd:dutyCycle %.2f", dutyCycle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (dutyCycle == 0.0f)
|
||||||
|
/**
|
||||||
|
* set the pin low just to be super sure
|
||||||
|
* this custom handling of zero value comes from CJ125 heater code
|
||||||
|
* TODO: is this really needed? cover by unit test?
|
||||||
|
*/
|
||||||
|
stateChangeCallback(this, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (dutyCycle < ZERO_PWM_THRESHOLD) {
|
if (dutyCycle < ZERO_PWM_THRESHOLD) {
|
||||||
mode = PM_ZERO;
|
mode = PM_ZERO;
|
||||||
} else if (dutyCycle > FULL_PWM_THRESHOLD) {
|
} else if (dutyCycle > FULL_PWM_THRESHOLD) {
|
||||||
|
|
|
@ -384,9 +384,6 @@ static void cjSetHeater(float value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
// todo: this should be moved to wboHeaterControl.setPwmDutyCycle()
|
// todo: this should be moved to wboHeaterControl.setPwmDutyCycle()
|
||||||
wboHeaterControl.setFrequency(heaterDuty == 0.0f ? NAN : CJ125_HEATER_PWM_FREQ);
|
wboHeaterControl.setFrequency(heaterDuty == 0.0f ? NAN : CJ125_HEATER_PWM_FREQ);
|
||||||
wboHeaterControl.setSimplePwmDutyCycle(heaterDuty);
|
wboHeaterControl.setSimplePwmDutyCycle(heaterDuty);
|
||||||
// This fixes pwm sticking to the last pin state
|
|
||||||
if (heaterDuty == 0.0f)
|
|
||||||
wboHeaterPin.setValue(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cjSetIdleHeater(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
static void cjSetIdleHeater(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
|
Loading…
Reference in New Issue