1
0
Fork 0

indicate the activate function isn't for general use

This commit is contained in:
Kevin Matz 2019-11-17 10:53:36 -05:00
parent 41a1b536ec
commit 6245c7ecd9
1 changed files with 4 additions and 3 deletions

View File

@ -25,7 +25,7 @@ from signal import pause
# Device.pin_factory = MockFactory()
def activate(path):
def _activate(path):
if path is None:
return
path = path.strip('\"').upper()
@ -54,8 +54,9 @@ for b in config.get('button', 'names').split(','):
print('init button on GPIO', p)
_buttons[b] = Button(p)
# connect button callbacks to anonymous functions
_buttons[b].when_pressed = lambda path=closed: activate(path)
_buttons[b].when_released = lambda path=opened: activate(path)
_buttons[b].when_pressed = lambda path=closed: _activate(path)
_buttons[b].when_released = lambda path=opened: _activate(path)
except (KeyError, GPIODeviceError) as e:
print('Error configuring button', b, e)
continue