rename variable for readability
This commit is contained in:
parent
4672fe993d
commit
7956b73e2f
16
buttond.py
16
buttond.py
|
@ -25,14 +25,14 @@ from signal import pause
|
||||||
# Device.pin_factory = MockFactory()
|
# Device.pin_factory = MockFactory()
|
||||||
|
|
||||||
|
|
||||||
def _activate(path):
|
def _activate(macro):
|
||||||
if path is None:
|
if macro is None:
|
||||||
return
|
return
|
||||||
path = path.strip('\"').upper()
|
macro = macro.strip('\"').upper()
|
||||||
if path is "":
|
if macro is "":
|
||||||
return
|
return
|
||||||
print("doing macro ", path)
|
print("doing macro ", macro)
|
||||||
comment(path)
|
comment(macro)
|
||||||
|
|
||||||
|
|
||||||
# empty button directory
|
# empty button directory
|
||||||
|
@ -55,9 +55,9 @@ for b in config.get('button', 'names').split(','):
|
||||||
_buttons[b] = Button(pin)
|
_buttons[b] = Button(pin)
|
||||||
# connect button callbacks to anonymous functions
|
# connect button callbacks to anonymous functions
|
||||||
print('connecting GPIO', pin, '"closed" to macro', closed)
|
print('connecting GPIO', pin, '"closed" to macro', closed)
|
||||||
_buttons[b].when_pressed = lambda path=closed: _activate(path)
|
_buttons[b].when_pressed = lambda macro=closed: _activate(macro)
|
||||||
print('connecting GPIO', pin, '"opened" to macro', opened)
|
print('connecting GPIO', pin, '"opened" to macro', opened)
|
||||||
_buttons[b].when_released = lambda path=opened: _activate(path)
|
_buttons[b].when_released = lambda macro=opened: _activate(macro)
|
||||||
|
|
||||||
except (KeyError, GPIODeviceError) as e:
|
except (KeyError, GPIODeviceError) as e:
|
||||||
print('Error configuring button', b, e)
|
print('Error configuring button', b, e)
|
||||||
|
|
Loading…
Reference in New Issue