indicate the activate function isn't for general use
This commit is contained in:
parent
41a1b536ec
commit
6245c7ecd9
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue