From 8fe215c95b178eb18c00cfe4299a30d99b312e23 Mon Sep 17 00:00:00 2001 From: Vitor de Miranda Henrique Date: Fri, 3 Mar 2017 00:13:21 -0600 Subject: [PATCH] Bug Fix --- octoprint_enclosure/__init__.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py index 6afd1af..36bde14 100644 --- a/octoprint_enclosure/__init__.py +++ b/octoprint_enclosure/__init__.py @@ -24,16 +24,17 @@ class EnclosureGPIO(): self.timeDelay = timeDelay def configureGPIO(self): - if self.isOutput: - if self.activeLow: #if is active low, we start disabelling it by making it high! - GPIO.setup(self.pinNumber, GPIO.OUT, initial=GPIO.HIGH) + if self.enable: + if self.isOutput: + if self.activeLow: #if is active low, we start disabelling it by making it high! + GPIO.setup(self.pinNumber, GPIO.OUT, initial=GPIO.HIGH) + else: + GPIO.setup(self.pinNumber, GPIO.OUT, initial=GPIO.LOW) else: - GPIO.setup(self.pinNumber, GPIO.OUT, initial=GPIO.LOW) - else: - if self.activeLow: - GPIO.setup(self.pinNumber, GPIO.IN, pull_up_down=GPIO.PUD_UP) - else: - GPIO.setup(self.pinNumber, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) + if self.activeLow: + GPIO.setup(self.pinNumber, GPIO.IN, pull_up_down=GPIO.PUD_UP) + else: + GPIO.setup(self.pinNumber, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) def write(self,active): if self.activeLow: