From eddfdb3ebc4910f0d15d026bf4b1bd984d4d59bf Mon Sep 17 00:00:00 2001 From: hmax42 Date: Sun, 10 Nov 2019 08:54:04 +0100 Subject: [PATCH 1/9] Plugin for the Pimoroni Button Shim this plugin enabled support for the 5 buttons of the shim. the rgb led is not supported yet. an example for config.yml lloks like this buttonshim: enabled: true buttons: - "date >> /home/pi/buttonA.txt" - "date >> /home/pi/buttonB.txt" - "date >> /home/pi/buttonC.txt" - "date >> /home/pi/buttonD.txt" - "date >> /home/pi/buttonE.txt" --- pwnagotchi/plugins/default/buttonshim.py | 446 +++++++++++++++++++++++ 1 file changed, 446 insertions(+) create mode 100644 pwnagotchi/plugins/default/buttonshim.py diff --git a/pwnagotchi/plugins/default/buttonshim.py b/pwnagotchi/plugins/default/buttonshim.py new file mode 100644 index 00000000..c627c696 --- /dev/null +++ b/pwnagotchi/plugins/default/buttonshim.py @@ -0,0 +1,446 @@ +import logging +import RPi.GPIO as GPIO +import subprocess +import pwnagotchi.plugins as plugins +import signal +import smbus +import time +from threading import Thread +import atexit +from colorsys import hsv_to_rgb + + +try: + import queue +except ImportError: + import Queue as queue + +ADDR = 0x3f + +#adapted from version 0.0.2 +__version__ = '0.0.2x' + +_bus = None + +LED_DATA = 7 +LED_CLOCK = 6 + +REG_INPUT = 0x00 +REG_OUTPUT = 0x01 +REG_POLARITY = 0x02 +REG_CONFIG = 0x03 + +NUM_BUTTONS = 5 + +BUTTON_A = 0 +"""Button A""" +BUTTON_B = 1 +"""Button B""" +BUTTON_C = 2 +"""Button C""" +BUTTON_D = 3 +"""Button D""" +BUTTON_E = 4 +"""Button E""" + +NAMES = ['A', 'B', 'C', 'D', 'E'] +"""Sometimes you want to print the plain text name of the button that's triggered. + +You can use:: + + buttonshim.NAMES[button_index] + +To accomplish this. + +""" + +ERROR_LIMIT = 10 + +FPS = 60 + +LED_GAMMA = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, + 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, + 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, + 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, + 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, + 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, + 90, 91, 93, 94, 95, 96, 98, 99, 100, 102, 103, 104, 106, 107, 109, 110, + 111, 113, 114, 116, 117, 119, 120, 121, 123, 124, 126, 128, 129, 131, 132, 134, + 135, 137, 138, 140, 142, 143, 145, 146, 148, 150, 151, 153, 155, 157, 158, 160, + 162, 163, 165, 167, 169, 170, 172, 174, 176, 178, 179, 181, 183, 185, 187, 189, + 191, 193, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, + 222, 224, 227, 229, 231, 233, 235, 237, 239, 241, 244, 246, 248, 250, 252, 255] + +# The LED is an APA102 driven via the i2c IO expander. +# We must set and clear the Clock and Data pins +# Each byte in _reg_queue represents a snapshot of the pin state + +_reg_queue = [] +_update_queue = [] +_brightness = 0.5 + +_led_queue = queue.Queue() + +_t_poll = None + +_running = False + +_states = 0b00011111 + + +class Handler(): + plugin = None + def __init__(self, plugin): + self.press = None + self.release = None + + self.hold = None + self.hold_time = 0 + + self.repeat = False + self.repeat_time = 0 + + self.t_pressed = 0 + self.t_repeat = 0 + self.hold_fired = False + self.plugin = plugin + +_handlers = [None,None,None,None,None] + + +def _run(): + global _running, _states + _running = True + _last_states = 0b00011111 + _errors = 0 + + while _running: + led_data = None + + try: + led_data = _led_queue.get(False) + _led_queue.task_done() + + except queue.Empty: + pass + + try: + if led_data: + for chunk in _chunk(led_data, 32): + _bus.write_i2c_block_data(ADDR, REG_OUTPUT, chunk) + + _states = _bus.read_byte_data(ADDR, REG_INPUT) + + except IOError: + _errors += 1 + if _errors > ERROR_LIMIT: + _running = False + raise IOError("More than {} IO errors have occurred!".format(ERROR_LIMIT)) + + for x in range(NUM_BUTTONS): + last = (_last_states >> x) & 1 + curr = (_states >> x) & 1 + handler = _handlers[x] + + # If last > curr then it's a transition from 1 to 0 + # since the buttons are active low, that's a press event + if last > curr: + handler.t_pressed = time.time() + handler.hold_fired = False + + if callable(handler.press): + handler.t_repeat = time.time() + Thread(target=handler.press, args=(x, True, handler.plugin)).start() + + continue + + if last < curr and callable(handler.release): + Thread(target=handler.release, args=(x, False, handler.plugin)).start() + continue + + if curr == 0: + if callable(handler.hold) and not handler.hold_fired and (time.time() - handler.t_pressed) > handler.hold_time: + Thread(target=handler.hold, args=(x,)).start() + handler.hold_fired = True + + if handler.repeat and callable(handler.press) and (time.time() - handler.t_repeat) > handler.repeat_time: + _handlers[x].t_repeat = time.time() + Thread(target=_handlers[x].press, args=(x, True, handler.plugin)).start() + + _last_states = _states + + time.sleep(1.0 / FPS) + + +def _quit(): + global _running + + if _running: + _led_queue.join() + set_pixel(0, 0, 0) + _led_queue.join() + + _running = False + _t_poll.join() + + +def setup(): + global _t_poll, _bus + + if _bus is not None: + return + + _bus = smbus.SMBus(1) + + _bus.write_byte_data(ADDR, REG_CONFIG, 0b00011111) + _bus.write_byte_data(ADDR, REG_POLARITY, 0b00000000) + _bus.write_byte_data(ADDR, REG_OUTPUT, 0b00000000) + + _t_poll = Thread(target=_run) + _t_poll.daemon = True + _t_poll.start() + + set_pixel(0, 0, 0) + + atexit.register(_quit) + + +def _set_bit(pin, value): + global _reg_queue + + if value: + _reg_queue[-1] |= (1 << pin) + else: + _reg_queue[-1] &= ~(1 << pin) + + +def _next(): + global _reg_queue + + if len(_reg_queue) == 0: + _reg_queue = [0b00000000] + else: + _reg_queue.append(_reg_queue[-1]) + + +def _enqueue(): + global _reg_queue + + _led_queue.put(_reg_queue) + + _reg_queue = [] + + +def _chunk(l, n): + for i in range(0, len(l)+1, n): + yield l[i:i + n] + + +def _write_byte(byte): + for x in range(8): + _next() + _set_bit(LED_CLOCK, 0) + _set_bit(LED_DATA, byte & 0b10000000) + _next() + _set_bit(LED_CLOCK, 1) + byte <<= 1 + + +def on_hold(buttons, handler=None, hold_time=2): + """Attach a hold handler to one or more buttons. + + This handler is fired when you hold a button for hold_time seconds. + + When fired it will run in its own Thread. + + It will be passed one argument, the button index:: + + @buttonshim.on_hold(buttonshim.BUTTON_A) + def handler(button): + # Your code here + + :param buttons: A single button, or a list of buttons + :param handler: Optional: a function to bind as the handler + :param hold_time: Optional: the hold time in seconds (default 2) + + """ + setup() + + if buttons is None: + buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E] + + if isinstance(buttons, int): + buttons = [buttons] + + def attach_handler(handler): + for button in buttons: + _handlers[button].hold = handler + _handlers[button].hold_time = hold_time + + if handler is not None: + attach_handler(handler) + else: + return attach_handler + + +def on_press(buttons, handler=None, repeat=False, repeat_time=0.5): + """Attach a press handler to one or more buttons. + + This handler is fired when you press a button. + + When fired it will be run in its own Thread. + + It will be passed two arguments, the button index and a + boolean indicating whether the button has been pressed/released:: + + @buttonshim.on_press(buttonshim.BUTTON_A) + def handler(button, pressed): + # Your code here + + :param buttons: A single button, or a list of buttons + :param handler: Optional: a function to bind as the handler + :param repeat: Optional: Repeat the handler if the button is held + :param repeat_time: Optional: Time, in seconds, after which to repeat + + """ + setup() + + if buttons is None: + buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E] + + if isinstance(buttons, int): + buttons = [buttons] + + def attach_handler(handler): + for button in buttons: + _handlers[button].press = handler + _handlers[button].repeat = repeat + _handlers[button].repeat_time = repeat_time + + if handler is not None: + attach_handler(handler) + else: + return attach_handler + + +def on_release(buttons=None, handler=None): + """Attach a release handler to one or more buttons. + + This handler is fired when you let go of a button. + + When fired it will be run in its own Thread. + + It will be passed two arguments, the button index and a + boolean indicating whether the button has been pressed/released:: + + @buttonshim.on_release(buttonshim.BUTTON_A) + def handler(button, pressed): + # Your code here + + :param buttons: A single button, or a list of buttons + :param handler: Optional: a function to bind as the handler + + """ + setup() + + if buttons is None: + buttons = [BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E] + + if isinstance(buttons, int): + buttons = [buttons] + + def attach_handler(handler): + for button in buttons: + _handlers[button].release = handler + + if handler is not None: + attach_handler(handler) + else: + return attach_handler + + +def set_brightness(brightness): + global _brightness + + setup() + + if not isinstance(brightness, int) and not isinstance(brightness, float): + raise ValueError("Brightness should be an int or float") + + if brightness < 0.0 or brightness > 1.0: + raise ValueError("Brightness should be between 0.0 and 1.0") + + _brightness = brightness + + +def set_pixel(r, g, b): + """Set the Button SHIM RGB pixel + + Display an RGB colour on the Button SHIM pixel. + + :param r: Amount of red, from 0 to 255 + :param g: Amount of green, from 0 to 255 + :param b: Amount of blue, from 0 to 255 + + You can use HTML colours directly with hexadecimal notation in Python. EG:: + + buttonshim.set_pixel(0xFF, 0x00, 0xFF) + + """ + setup() + + if not isinstance(r, int) or r < 0 or r > 255: + raise ValueError("Argument r should be an int from 0 to 255") + + if not isinstance(g, int) or g < 0 or g > 255: + raise ValueError("Argument g should be an int from 0 to 255") + + if not isinstance(b, int) or b < 0 or b > 255: + raise ValueError("Argument b should be an int from 0 to 255") + + r, g, b = [int(x * _brightness) for x in (r, g, b)] + + _write_byte(0) + _write_byte(0) + _write_byte(0b11101111) + _write_byte(LED_GAMMA[b & 0xff]) + _write_byte(LED_GAMMA[g & 0xff]) + _write_byte(LED_GAMMA[r & 0xff]) + _write_byte(0) + _write_byte(0) + _enqueue() + +def runCommand(button, pressed, plugin): + logging.debug(f"Button Pressed! Loading command from slot '{button}'") + command = plugin.commands[button] + logging.debug(f"Button Pressed! Running command: {command}") + process = subprocess.Popen(command, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash") + procfess.wait() + +class Buttonshim(plugins.Plugin): + __author__ = 'gon@o2online.de' + __version__ = '0.0.1' + __license__ = 'GPL3' + __description__ = 'Pimoroni Button Shim GPIO Button and RGB LED support plugin based on the pimoroni-buttonshim-lib and the pwnagotchi-gpio-buttons-plugin' + + def __init__(self): + self.running = False + self.options = dict() + self.commands = ['', '', '', '', ''] + global _handlers + _handlers = [Handler(self) for x in range(NUM_BUTTONS)] + on_press([BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E], runCommand) + + def on_loaded(self): + i = 0 + for b in self.options['buttons']: + self.commands[i] = b + logging.debug(f"Loaded command '{b}' into slot '{i}'.") + i=i+1 + logging.info("Button Shim GPIO Button plugin loaded.") + self.running = True From 92c1b6b00591938cd989d6e44dec05c5a4951369 Mon Sep 17 00:00:00 2001 From: hmax42 Date: Sun, 10 Nov 2019 13:44:35 +0100 Subject: [PATCH 2/9] blinking with static colors --- pwnagotchi/plugins/default/buttonshim.py | 25 +++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/pwnagotchi/plugins/default/buttonshim.py b/pwnagotchi/plugins/default/buttonshim.py index c627c696..3e5a1c86 100644 --- a/pwnagotchi/plugins/default/buttonshim.py +++ b/pwnagotchi/plugins/default/buttonshim.py @@ -415,12 +415,25 @@ def set_pixel(r, g, b): _write_byte(0) _enqueue() +def blink(r, g, b, t, repeats): + for i in range(0, repeats + 1): + set_pixel(r, g, b) + time.sleep(t) + set_pixel(0, 0, 0) + time.sleep(t) + def runCommand(button, pressed, plugin): - logging.debug(f"Button Pressed! Loading command from slot '{button}'") + logging.debug(f"[buttonshim] Button Pressed! Loading command from slot '{button}' for button '{NAMES[button]}'") command = plugin.commands[button] - logging.debug(f"Button Pressed! Running command: {command}") + logging.debug(f"[buttonshim] Running command: {command}") process = subprocess.Popen(command, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash") - procfess.wait() + r = plugin.colors[button][0] + g = plugin.colors[button][1] + b = plugin.colors[button][2] + thread = Thread(target=blink,args=(r, g, b, 0.3, 3)) + thread.start() + process.wait() + thread.stop() class Buttonshim(plugins.Plugin): __author__ = 'gon@o2online.de' @@ -432,6 +445,7 @@ class Buttonshim(plugins.Plugin): self.running = False self.options = dict() self.commands = ['', '', '', '', ''] + self.colors = [[0xFF,0x00,0x00],[0x00,0xFF,0x00],[0x00,0x00,0xFF],[0xFF,0xFF,0x00],[0x00,0xFF,0xFF]] global _handlers _handlers = [Handler(self) for x in range(NUM_BUTTONS)] on_press([BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E], runCommand) @@ -440,7 +454,8 @@ class Buttonshim(plugins.Plugin): i = 0 for b in self.options['buttons']: self.commands[i] = b - logging.debug(f"Loaded command '{b}' into slot '{i}'.") + #self.colors = self.options['colors'] + logging.debug(f"[buttonshim] Loaded command '{b}' into slot '{i}' for button '{NAMES[i]}'.") i=i+1 - logging.info("Button Shim GPIO Button plugin loaded.") + logging.info("[buttonshim] GPIO Button plugin loaded.") self.running = True From b903f636d2a26277c34a65cc7163009a5281921a Mon Sep 17 00:00:00 2001 From: hmax42 Date: Mon, 11 Nov 2019 19:04:56 +0100 Subject: [PATCH 3/9] Blinking works now freely --- pwnagotchi/plugins/default/buttonshim.py | 55 +++++++++++++----------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/pwnagotchi/plugins/default/buttonshim.py b/pwnagotchi/plugins/default/buttonshim.py index 3e5a1c86..cb814b27 100644 --- a/pwnagotchi/plugins/default/buttonshim.py +++ b/pwnagotchi/plugins/default/buttonshim.py @@ -415,25 +415,40 @@ def set_pixel(r, g, b): _write_byte(0) _enqueue() -def blink(r, g, b, t, repeats): - for i in range(0, repeats + 1): +def blink(r, g, b, ontime, offtime, blinktimes): + logging.info("[buttonshim] Blink") + for i in range(0, blinktimes): set_pixel(r, g, b) - time.sleep(t) + time.sleep(ontime) set_pixel(0, 0, 0) - time.sleep(t) - + time.sleep(offtime) + def runCommand(button, pressed, plugin): - logging.debug(f"[buttonshim] Button Pressed! Loading command from slot '{button}' for button '{NAMES[button]}'") - command = plugin.commands[button] - logging.debug(f"[buttonshim] Running command: {command}") - process = subprocess.Popen(command, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash") - r = plugin.colors[button][0] - g = plugin.colors[button][1] - b = plugin.colors[button][2] - thread = Thread(target=blink,args=(r, g, b, 0.3, 3)) - thread.start() - process.wait() - thread.stop() + logging.info(f"[buttonshim] Button Pressed! Loading command from slot '{button}' for button '{NAMES[button]}'") + bCfg = plugin.options['buttons'][NAMES[button]] + blinkCfg = bCfg['blink'] + logging.debug(blink) + if blinkCfg['enabled'] == True: + logging.debug(f"[buttonshim] Blinking led") + red = int(blinkCfg['red']) + green = int(blinkCfg['green']) + blue = int(blinkCfg['blue']) + on_time = float(blinkCfg['on_time']) + off_time = float(blinkCfg['off_time']) + blink_times = int(blinkCfg['blink_times']) + logging.debug(f"red {red} green {green} blue {blue} on_time {on_time} off_time {off_time} blink_times {blink_times}") + thread = Thread(target=blink, args=(red, green, blue, on_time, off_time, blink_times)) + thread.start() + logging.debug(f"[buttonshim] Blink thread started") + command = bCfg['command'] + if command == '': + logging.debug(f"[buttonshim] Command empty") + else: + logging.debug(f"[buttonshim] Process create: {command}") + process = subprocess.Popen(command, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash") + process.wait() + process = None + logging.debug(f"[buttonshim] Process end") class Buttonshim(plugins.Plugin): __author__ = 'gon@o2online.de' @@ -444,18 +459,10 @@ class Buttonshim(plugins.Plugin): def __init__(self): self.running = False self.options = dict() - self.commands = ['', '', '', '', ''] - self.colors = [[0xFF,0x00,0x00],[0x00,0xFF,0x00],[0x00,0x00,0xFF],[0xFF,0xFF,0x00],[0x00,0xFF,0xFF]] global _handlers _handlers = [Handler(self) for x in range(NUM_BUTTONS)] on_press([BUTTON_A, BUTTON_B, BUTTON_C, BUTTON_D, BUTTON_E], runCommand) def on_loaded(self): - i = 0 - for b in self.options['buttons']: - self.commands[i] = b - #self.colors = self.options['colors'] - logging.debug(f"[buttonshim] Loaded command '{b}' into slot '{i}' for button '{NAMES[i]}'.") - i=i+1 logging.info("[buttonshim] GPIO Button plugin loaded.") self.running = True From 30b1874a0a8cffdca2d80f57aa3532b65fe7cf4f Mon Sep 17 00:00:00 2001 From: hmax42 Date: Mon, 11 Nov 2019 19:08:12 +0100 Subject: [PATCH 4/9] New defaults for buttonshim --- pwnagotchi/defaults.yml | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/pwnagotchi/defaults.yml b/pwnagotchi/defaults.yml index f083270a..6d5ae55e 100644 --- a/pwnagotchi/defaults.yml +++ b/pwnagotchi/defaults.yml @@ -133,6 +133,59 @@ main: enabled: true # specify a maximum size to rotate ( format is 10/10B, 10K, 10M 10G ) size: '10M' + buttonshim: + enabled: false + buttons: + A: + command: '' + blink: + enabled: false + red: 0 + green: 0 + blue: 0 + on_time: 0 + off_time: 0 + blink_times: 0 + B: + command: '' + blink: + enabled: false + red: 0 + green: 0 + blue: 0 + on_time: 0 + off_time: 0 + blink_times: 0 + C: + command: '' + blink: + enabled: false + red: 0 + green: 0 + blue: 0 + on_time: 0 + off_time: 0 + blink_times: 0 + D: + command: '' + blink: + enabled: false + red: 0 + green: 0 + blue: 0 + on_time: 0 + off_time: 0 + blink_times: 0 + E: + command: '' + blink: + enabled: false + red: 0 + green: 0 + blue: 0 + on_time: 0 + off_time: 0 + blink_times: 0 ai: # if false, only the default 'personality' will be used From 1c299832ae2b2f0bf94e73f493e9b5cc081628b0 Mon Sep 17 00:00:00 2001 From: hmax42 Date: Sun, 1 Dec 2019 07:56:03 +0100 Subject: [PATCH 5/9] add ws1 --- pwnagotchi/plugins/default/gps.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pwnagotchi/plugins/default/gps.py b/pwnagotchi/plugins/default/gps.py index 451fc7a6..7a0a27a3 100644 --- a/pwnagotchi/plugins/default/gps.py +++ b/pwnagotchi/plugins/default/gps.py @@ -54,6 +54,10 @@ class GPS(plugins.Plugin): lat_pos = (127, 75) lon_pos = (122, 84) alt_pos = (127, 94) + elif ui.is_waveshare_v1(): + lat_pos = (127, 75) + lon_pos = (122, 84) + alt_pos = (127, 94) elif ui.is_inky(): # guessed values, add tested ones if you can lat_pos = (112, 30) From 6df7bcd8859a7a512cb20a5b581aeb233505fe0b Mon Sep 17 00:00:00 2001 From: hmax42 Date: Sun, 1 Dec 2019 07:56:09 +0100 Subject: [PATCH 6/9] add ws1 --- pwnagotchi/plugins/default/memtemp.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pwnagotchi/plugins/default/memtemp.py b/pwnagotchi/plugins/default/memtemp.py index 83a3dc8c..02a619d3 100644 --- a/pwnagotchi/plugins/default/memtemp.py +++ b/pwnagotchi/plugins/default/memtemp.py @@ -44,6 +44,9 @@ class MemTemp(plugins.Plugin): if ui.is_waveshare_v2(): h_pos = (180, 80) v_pos = (180, 61) + if ui.is_waveshare_v1(): + h_pos = (180, 80) + v_pos = (180, 61) elif ui.is_inky(): h_pos = (140, 68) v_pos = (165, 54) From 42ed6985834949fca8479bf4b3a9dc28bb8c303d Mon Sep 17 00:00:00 2001 From: hmax42 Date: Sun, 1 Dec 2019 08:06:14 +0100 Subject: [PATCH 7/9] Update memtemp.py --- pwnagotchi/plugins/default/memtemp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnagotchi/plugins/default/memtemp.py b/pwnagotchi/plugins/default/memtemp.py index 02a619d3..a3b9f91f 100644 --- a/pwnagotchi/plugins/default/memtemp.py +++ b/pwnagotchi/plugins/default/memtemp.py @@ -44,7 +44,7 @@ class MemTemp(plugins.Plugin): if ui.is_waveshare_v2(): h_pos = (180, 80) v_pos = (180, 61) - if ui.is_waveshare_v1(): + elif ui.is_waveshare_v1(): h_pos = (180, 80) v_pos = (180, 61) elif ui.is_inky(): From 7b219fd139c646791a794bfab574a86b7e35a107 Mon Sep 17 00:00:00 2001 From: hmax42 Date: Sun, 1 Dec 2019 14:27:10 +0100 Subject: [PATCH 8/9] Update memtemp.py --- pwnagotchi/plugins/default/memtemp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwnagotchi/plugins/default/memtemp.py b/pwnagotchi/plugins/default/memtemp.py index a3b9f91f..8375ac4a 100644 --- a/pwnagotchi/plugins/default/memtemp.py +++ b/pwnagotchi/plugins/default/memtemp.py @@ -45,8 +45,8 @@ class MemTemp(plugins.Plugin): h_pos = (180, 80) v_pos = (180, 61) elif ui.is_waveshare_v1(): - h_pos = (180, 80) - v_pos = (180, 61) + h_pos = (170, 80) + v_pos = (170, 61) elif ui.is_inky(): h_pos = (140, 68) v_pos = (165, 54) From f563d71477e58632c2a0fbde2c14604f3ce18d2d Mon Sep 17 00:00:00 2001 From: hmax42 Date: Sun, 1 Dec 2019 14:27:13 +0100 Subject: [PATCH 9/9] Update gps.py --- pwnagotchi/plugins/default/gps.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pwnagotchi/plugins/default/gps.py b/pwnagotchi/plugins/default/gps.py index 7a0a27a3..193671ab 100644 --- a/pwnagotchi/plugins/default/gps.py +++ b/pwnagotchi/plugins/default/gps.py @@ -55,9 +55,9 @@ class GPS(plugins.Plugin): lon_pos = (122, 84) alt_pos = (127, 94) elif ui.is_waveshare_v1(): - lat_pos = (127, 75) - lon_pos = (122, 84) - alt_pos = (127, 94) + lat_pos = (130, 70) + lon_pos = (125, 80) + alt_pos = (130, 90) elif ui.is_inky(): # guessed values, add tested ones if you can lat_pos = (112, 30)