diff --git a/octoprint_psucontrol_rpigpio/__init__.py b/octoprint_psucontrol_rpigpio/__init__.py index 0fa19ab..677c7ec 100644 --- a/octoprint_psucontrol_rpigpio/__init__.py +++ b/octoprint_psucontrol_rpigpio/__init__.py @@ -122,19 +122,6 @@ def configure_gpio(self): else: return - if self.config['onoffGPIOPin'] > 0: - self._logger.info("Configuring GPIO for pin {}".format(self.config['onoffGPIOPin'])) - try: - if not self.config['invertonoffGPIOPin']: - initial_pin_output=GPIO.LOW - else: - initial_pin_output=GPIO.HIGH - - GPIO.setup(self._gpio_get_pin(self.config['onoffGPIOPin']), GPIO.OUT, initial=initial_pin_output) - self._configuredGPIOPins.append(self.config['onoffGPIOPin']) - except (RuntimeError, ValueError) as e: - self._logger.error(e) - if self.config['senseGPIOPin'] > 0: self._logger.info("Configuring GPIO for pin {}".format(self.config['senseGPIOPin'])) @@ -151,6 +138,19 @@ def configure_gpio(self): except (RuntimeError, ValueError) as e: self._logger.error(e) + if self.config['onoffGPIOPin'] > 0: + self._logger.info("Configuring GPIO for pin {}".format(self.config['onoffGPIOPin'])) + try: + if not self.config['invertonoffGPIOPin']: + initial_pin_output=GPIO.LOW + else: + initial_pin_output=GPIO.HIGH + + GPIO.setup(self._gpio_get_pin(self.config['onoffGPIOPin']), GPIO.OUT, initial=initial_pin_output) + self._configuredGPIOPins.append(self.config['onoffGPIOPin']) + except (RuntimeError, ValueError) as e: + self._logger.error(e) + def cleanup_gpio(self): GPIO.setwarnings(False)