Skip to content

Instantly share code, notes, and snippets.

@GermaniumSystem
Last active September 28, 2019 07:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GermaniumSystem/eddd08d5178672175b7fe391e91cb659 to your computer and use it in GitHub Desktop.
Save GermaniumSystem/eddd08d5178672175b7fe391e91cb659 to your computer and use it in GitHub Desktop.
Pwnagotchi Waveshare V1 module support hack
Preface:
This guide shows how to quickly hack in support for the Waveshare V1 display module. Expect this guide to become inaccurate, as official support may be added soon.
This guide does not cover the 3-color variants. The same idea should work, but you will need to supply a second image buffer in .display().
Steps:
0. If you have already run a V1 module with stock pwnagotchi code, the screen is probably damaged. It can be revived by disconnecting it and leaving it in a dark location for a while - probably overnight. The screen may still show signs of damage, but it will be usable.
1. Replace /root/pwnagotchi/scripts/pwnagotchi/ui/waveshare.py with https://github.com/waveshare/e-Paper/blob/master/RaspberryPi%26JetsonNano/python/lib/waveshare_epd/epd2in13.py
2. Create /root/pwnagotchi/scripts/pwnagotchi/ui/epdconfig.py containing https://github.com/waveshare/e-Paper/blob/master/RaspberryPi%26JetsonNano/python/lib/waveshare_epd/epdconfig.py
3. Update /root/pwnagotchi/scripts/pwnagotchi/ui/display.py to support the library. A diff is provided in display.diff.
4. Tune the refresh interval to your liking.
5. ???
6. Profit.
diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/display.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/display.py
index 5a1d03d..f8029df 100644
--- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/display.py
+++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/display.py
@@ -80,6 +80,8 @@ class Display(View):
self._display = None
self._httpd = None
self.canvas = None
+ self._frame_counter = 0
+ self._refresh_interval = 60
if self._enabled:
self._init_display()
@@ -102,9 +104,9 @@ class Display(View):
from pwnagotchi.ui.waveshare import EPD
# core.log("display module started")
self._display = EPD()
- self._display.init(self._display.FULL_UPDATE)
+ self._display.init(self._display.lut_full_update)
self._display.Clear(WHITE)
- self._display.init(self._display.PART_UPDATE)
+ self._display.init(self._display.lut_partial_update)
self.on_render(self._on_view_rendered)
def image(self):
@@ -120,4 +122,11 @@ class Display(View):
if self._enabled:
self.canvas = img if self._rotation == 0 else img.rotate(self._rotation)
buf = self._display.getbuffer(self.canvas)
- self._display.displayPartial(buf)
+ if self._frame_counter > self._refresh_interval:
+ self._display.init(self._display.lut_full_update)
+ self._display.Clear(WHITE)
+ self._display.init(self._display.lut_partial_update)
+ self._frame_counter = 0
+ else:
+ self._frame_counter += 1
+ self._display.display(buf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment