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
94ca216936
commit
103a1693c8
|
@ -75,13 +75,14 @@ void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
|
||||||
warning(CUSTOM_PWM_DUTY_TOO_HIGH, "%s duty %.2f", name, dutyCycle);
|
warning(CUSTOM_PWM_DUTY_TOO_HIGH, "%s duty %.2f", name, dutyCycle);
|
||||||
dutyCycle = 1;
|
dutyCycle = 1;
|
||||||
}
|
}
|
||||||
if (dutyCycle == 0.0f && stateChangeCallback != NULL) {
|
|
||||||
/**
|
// Handle zero and full duty cycle. This will cause the PWM output to behave like a plain digital output.
|
||||||
* set the pin low just to be super sure
|
if (dutyCycle == 0.0f && stateChangeCallback) {
|
||||||
* this custom handling of zero value comes from CJ125 heater code
|
// Manually fire falling edge
|
||||||
* TODO: is this really needed? cover by unit test?
|
|
||||||
*/
|
|
||||||
stateChangeCallback(0, arg);
|
stateChangeCallback(0, arg);
|
||||||
|
} else if (dutyCycle == 1.0f && stateChangeCallback) {
|
||||||
|
// Manually fire rising edge
|
||||||
|
stateChangeCallback(1, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dutyCycle < ZERO_PWM_THRESHOLD) {
|
if (dutyCycle < ZERO_PWM_THRESHOLD) {
|
||||||
|
|
Loading…
Reference in New Issue