From 32237f892143add377a31a72c9850cde6f92e803 Mon Sep 17 00:00:00 2001 From: Lonja Selter Date: Thu, 28 Mar 2019 12:37:55 +0000 Subject: [PATCH] try-except for creating pwm instances --- octoprint_enclosure/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index 39c81cd..15ca72b 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -916,7 +916,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, self.log_error(ex) def clear_channel(self, channel): - self._logging.debug("Clearing channel: %s", channel) + self._logger.debug("Clearing channel: %s", channel) try: GPIO.cleanup(self.to_int(channel)) except Exception as ex: @@ -946,6 +946,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, self._logger.info("Setting GPIO pin %s as PWM", pin) for pwm in (pwm_dict for pwm_dict in self.pwm_intances if pin in pwm_dict): + pwm.stop() self.pwm_intances.remove(pwm) self.clear_channel(pin) try: