Skip to content

Commit

Permalink
fix pwm: restore old behaviour for turning off (does not turn off som…
Browse files Browse the repository at this point in the history
…etimes...)
  • Loading branch information
Markus Kirberg committed May 17, 2024
1 parent edaaedb commit 146c950
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/shelly_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ Status OutputPin::SetState(bool on, const char *source) {

Status OutputPin::SetStatePWM(float duty, const char *source) {
LOG(LL_INFO, ("Duty: %.3f", duty));
if (duty == 0 || duty == 1) {
mgos_gpio_write(pin_, duty);
if (duty == 0) {
mgos_pwm_set(pin_, 0, 0);
} else if (duty == 1) {
mgos_gpio_write(pin_, 1);
LOG(LL_INFO,
("Output %d: %s (%s)", id(), (duty == 0 ? "OFF" : "ON"), source));
} else {
Expand Down

0 comments on commit 146c950

Please sign in to comment.