From 6245c7ecd9c007fa2f7062f0b37320823ebf3cd5 Mon Sep 17 00:00:00 2001 From: Kevin Matz Date: Sun, 17 Nov 2019 10:53:36 -0500 Subject: [PATCH] indicate the activate function isn't for general use --- buttond.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/buttond.py b/buttond.py index 7afa2ee..60c0df8 100755 --- a/buttond.py +++ b/buttond.py @@ -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