99
1010class FANShim ():
1111 def __init__ (self ):
12- self ._pin_fancontrol = 18
12+ self ._pin_fancontrol = 18
1313 self ._pin_button = 17
1414 self ._button_press_handler = None
1515 self ._button_release_handler = None
1616 self ._button_hold_handler = None
1717 self ._t_poll = None
18-
18+
1919 atexit .register (self ._cleanup )
2020
2121 GPIO .setwarnings (False )
@@ -42,7 +42,7 @@ def stop(self):
4242
4343 def on_press (self , handler = None ):
4444 def attach_handler (handler ):
45- self ._button_press_handler = handler
45+ self ._button_press_handler = handler
4646
4747 if handler is not None :
4848 attach_handler (handler )
@@ -69,7 +69,7 @@ def attach_handler(handler):
6969
7070 def set_hold_time (self , hold_time ):
7171 """Set the button hold time in seconds.
72-
72+
7373 :param hold_time: Amount of time button must be held to trigger on_hold (in seconds)
7474
7575 """
@@ -83,9 +83,9 @@ def toggle_fan(self):
8383
8484 def set_fan (self , fan_state ):
8585 """Set the fan on/off.
86-
86+
8787 :param fan_state: True/False for on/off
88-
88+
8989 """
9090 GPIO .output (self ._pin_fancontrol , True if fan_state else False )
9191 return True if fan_state else False
@@ -125,4 +125,3 @@ def _run(self):
125125 last = current
126126
127127 time .sleep (0.001 )
128-
0 commit comments