fix gppwm on-off mode (#1406)
* fix * put it back * do it with PWM instead * comments Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
1a55d40863
commit
96a800acb9
|
@ -75,13 +75,14 @@ void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
|
|||
warning(CUSTOM_PWM_DUTY_TOO_HIGH, "%s duty %.2f", name, dutyCycle);
|
||||
dutyCycle = 1;
|
||||
}
|
||||
if (dutyCycle == 0.0f && stateChangeCallback != NULL) {
|
||||
/**
|
||||
* 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?
|
||||
*/
|
||||
|
||||
// Handle zero and full duty cycle. This will cause the PWM output to behave like a plain digital output.
|
||||
if (dutyCycle == 0.0f && stateChangeCallback) {
|
||||
// Manually fire falling edge
|
||||
stateChangeCallback(0, arg);
|
||||
} else if (dutyCycle == 1.0f && stateChangeCallback) {
|
||||
// Manually fire rising edge
|
||||
stateChangeCallback(1, arg);
|
||||
}
|
||||
|
||||
if (dutyCycle < ZERO_PWM_THRESHOLD) {
|
||||
|
|
Loading…
Reference in New Issue