reference switch name in output
This commit is contained in:
parent
32549a4d66
commit
0c69f65805
|
@ -53,12 +53,12 @@ for b in config.get('button', 'names').split(','):
|
||||||
closed = c.get('close', None)
|
closed = c.get('close', None)
|
||||||
opened = c.get('open', None)
|
opened = c.get('open', None)
|
||||||
# set up button on pin
|
# set up button on pin
|
||||||
print('init button on GPIO', pin)
|
print('init', b, 'on GPIO', pin)
|
||||||
_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', b, '"closed" to macro', closed)
|
||||||
_buttons[b].when_pressed = lambda macro=closed: _activate(macro)
|
_buttons[b].when_pressed = lambda macro=closed: _activate(macro)
|
||||||
print('connecting GPIO', pin, '"opened" to macro', opened)
|
print('connecting', b, '"opened" to macro', opened)
|
||||||
_buttons[b].when_released = lambda macro=opened: _activate(macro)
|
_buttons[b].when_released = lambda macro=opened: _activate(macro)
|
||||||
|
|
||||||
except (KeyError, GPIODeviceError) as e:
|
except (KeyError, GPIODeviceError) as e:
|
||||||
|
|
Loading…
Reference in New Issue