Merge pull request from dadav/fix/gpio-plugin

Fix options of gpio-plugin
This commit is contained in:
evilsocket 2019-11-07 10:38:16 +01:00 committed by GitHub
commit 8d8333b586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions
pwnagotchi

@ -106,8 +106,8 @@ main:
enabled: false
#The following is a list of the GPIO number for your button, and the command you want to run when it is pressed
gpios:
- 20: 'sudo touch /root/.pwnagotchi-auto && sudo systemctl restart pwnagotchi'
- 21: 'shutdown -h now'
20: 'touch /root/.pwnagotchi-auto && systemctl restart pwnagotchi'
21: 'shutdown -h now'
# monitor interface to use
iface: mon0
# command to run to bring the mon interface up in case it's not up already

@ -31,9 +31,7 @@ class GPIOButtons(plugins.Plugin):
# set gpio numbering
GPIO.setmode(GPIO.BCM)
for i in gpios:
gpio = list(i)[0]
command = i[gpio]
for gpio, command in gpios.items():
self.ports[gpio] = command
GPIO.setup(gpio, GPIO.IN, GPIO.PUD_UP)
GPIO.add_event_detect(gpio, GPIO.FALLING, callback=self.runCommand, bouncetime=250)