From 23cd8ad599ba16835ba5472394f13d9440bee4d1 Mon Sep 17 00:00:00 2001
From: "Michael V. Swisher" <daswisher@gmail.com>
Date: Sat, 5 Oct 2019 06:55:04 -0700
Subject: [PATCH] Updating so waveshare 2.13 b/c models only have to maintain
 black color channel. Color channels aren't used so no need to maintain them

---
 .../root/pwnagotchi/scripts/pwnagotchi/ui/display.py   | 10 +++++++---
 .../scripts/pwnagotchi/ui/waveshare/v1/epd2in13bc.py   |  9 +++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/display.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/display.py
index d6e00d1..88ea5d4 100644
--- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/display.py
+++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/display.py
@@ -208,9 +208,13 @@ class Display(View):
 
     def _waveshare_bc_render(self):
         buf_black = self._display.getbuffer(self.canvas)
-        emptyImage = Image.new('1', (self._display.height, self._display.width), 255)
-        buf_color = self._display.getbuffer(emptyImage)
-        self._display.display(buf_black,buf_color)
+        # emptyImage = Image.new('1', (self._display.height, self._display.width), 255)
+        # buf_color = self._display.getbuffer(emptyImage)
+        # self._display.display(buf_black,buf_color)
+
+        # Custom display function that only handles black
+        # Was included in epd2in13bc.py 
+        self._display.displayBlack(buf_black)
 
 
         
diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/waveshare/v1/epd2in13bc.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/waveshare/v1/epd2in13bc.py
index c22da4b..ec92465 100644
--- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/waveshare/v1/epd2in13bc.py
+++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/ui/waveshare/v1/epd2in13bc.py
@@ -117,6 +117,15 @@ class EPD:
                         buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8))
         return buf
 
+    def displayBlack(self, imageblack):
+        self.send_command(0x10)
+        for i in range(0, int(self.width * self.height / 8)):
+            self.send_data(imageblack[i])
+        self.send_command(0x92)
+        
+        self.send_command(0x12) # REFRESH
+        self.ReadBusy()
+
     def display(self, imageblack, imagecolor):
         self.send_command(0x10)
         for i in range(0, int(self.width * self.height / 8)):