Skip to content

Commit a8dfd0a

Browse files
committed
Fix property access
1 parent da8aedf commit a8dfd0a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

octoprint_filamentreload/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@ def initialize(self):
1919
GPIO.setmode(GPIO.BOARD) # Use the board numbering scheme
2020
GPIO.setwarnings(False) # Disable GPIO warnings
2121

22+
@property
23+
def pin(self):
24+
return int(self._settings.get(["pin"]))
25+
26+
@property
27+
def bounce(self):
28+
return int(self._settings.get(["bounce"]))
29+
30+
@property
31+
def switch(self):
32+
return int(self._settings.get(["switch"]))
33+
2234
def on_after_startup(self):
2335
self._logger.info("Filament Sensor Reloaded started")
24-
self.pin = int(self._settings.get(["pin"]))
25-
self.bounce = int(self._settings.get(["bounce"]))
26-
self.switch = int(self._settings.get(["switch"]))
27-
2836
if self._settings.get(["pin"]) != "-1": # If a pin is defined
2937
self._logger.info("Filament Sensor active on GPIO Pin [%s]"%self.pin)
3038
GPIO.setup(self.pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Initialize GPIO as INPUT

0 commit comments

Comments
 (0)