From a5808e2fca043dcacc2de8563533f71d1a12fb39 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 26 Oct 2017 17:17:08 +1100 Subject: [PATCH] esp32/machine_pwm: Always set the channel in the PWM object. --- ports/esp32/machine_pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32/machine_pwm.c b/ports/esp32/machine_pwm.c index 489833e7c2..4d6c59f0fa 100644 --- a/ports/esp32/machine_pwm.c +++ b/ports/esp32/machine_pwm.c @@ -131,6 +131,7 @@ STATIC void esp32_pwm_init_helper(esp32_pwm_obj_t *self, } channel = avail; } + self->channel = channel; // New PWM assignment self->active = 1; @@ -148,7 +149,6 @@ STATIC void esp32_pwm_init_helper(esp32_pwm_obj_t *self, "PWM not supported on pin %d", self->pin)); } chan_gpio[channel] = self->pin; - self->channel = channel; } // Maybe change PWM timer