diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..6b1e344 Binary files /dev/null and b/.DS_Store differ diff --git a/EinkPaper.py b/EinkPaper.py index d851cfc..92df3e5 100644 --- a/EinkPaper.py +++ b/EinkPaper.py @@ -50,7 +50,7 @@ def initWidgets(): widgetList.append(widget.TextWidget(cwidth, cheight, 0, 0, 1, 2, str1)) widgetList.append(widget.TextWidget(cwidth, cheight, 1, 0, 2, 1, str2)) #widgetList.append(widget.ImageWidget(cwidth, cheight, 2, 1, 1, 1, "mono", "faces.jpg")) - widgetList.append(widget.ImageWidget(cwidth, cheight, 1, 1, 2, 2, "mono", "img1.jpg")) + widgetList.append(widget.ImageWidget(cwidth, cheight, 1, 1, 2, 2, "mono", "calvin.jpg")) widgetList.append(widget.ImageWidget(cwidth, cheight, 0, 2, 1, 1, "mono", "img1.jpg")) return widgetList diff --git a/imgBlack.bmp b/imgBlack.bmp index eece3db..37b436a 100644 Binary files a/imgBlack.bmp and b/imgBlack.bmp differ diff --git a/main.py b/main.py deleted file mode 100644 index c9d1c9c..0000000 --- a/main.py +++ /dev/null @@ -1,26 +0,0 @@ -import epd7in5b -from PIL import Image, ImageDraw, ImageFont, ImageOps -import re -from renderer import Rend - -WIDTH = 640 -HEIGHT = 384 - -def main(): - epd = epd7in5b.EPD() - epd.init() - - rend = Rend() - rend.render() - - print("start display frame") - epd.display_frame(epd.get_frame_buffer(rend.image_black),epd.get_frame_buffer(rend.image_yellow)) - print("finish display frame") - - #display images - #frame_black = epd.get_frame_buffer(Image.open('black.bmp')) - #frame_yellow = epd.get_frame_buffer(Image.open('red2.bmp')) - #epd.display_frame(frame_black, frame_yellow) - -if __name__ == '__main__': - main() diff --git a/readme.md b/readme.md index 28fe623..cecfe4d 100644 --- a/readme.md +++ b/readme.md @@ -4,4 +4,33 @@ Test mode will auto run if no external display package is detected. EinkPaper.py will construct widget classes from widgets.py. Widgets are constructed in the initWidgets() function in EinkPaper.py. -The image widget is currently set to resize (to fit the whole image on the widget w/ no cropping), then to either monochrome or greyscale dither the image as specified in initWidgets(). The zoom function is currently broken and to be fixed. \ No newline at end of file +The image widget is currently set to resize (to fit the whole image on the widget w/ no cropping), then to either monochrome or greyscale dither the image as specified in initWidgets(). The zoom function is currently broken and to be fixed. + +--- Program flow --- + +config data --> EinkPaper.py + + Configuration of the widgets to be displayed is stored in the Einkpaper.py initWidgets() function. A new instance of a widget class is added to the widgetList array. + + General form: widget."widget name"(cwidth, cheight, x coord, y coord, width(by cell), height(by cell), OTHER ARGUMENTS...) + e.g. + widgetList.append(widget.ImageWidget(cwidth, cheight, 1, 1, 2, 2, "mono", "calvin.jpg")) + + Text widget has one 'other argument', it is the string to be displayed on the widget. Image widget has two other args, the type of black and white filter to process the image with, and the location or filename of the image. The two b&w filters are "mono" for monochrome, and "dither" for greyscale dithering. + + Widgets will be drawn on the final canvas in the order they are appended to the widgetList array. + +widget.py --> EinkPaper.py + + When an instance of a widget class is created it will perform necessary computations, network tasks, and image operations to store an updated image object. This image object is the image of the widget to be passed back to EinkPaper.py's render() function. The size of this image will be some multiple of the cell size as specified in EinkPaper.py. + +--- Running the program --- + + The program is built for python2. + $ python EinkPaper.py + If the display package is present, will run with test mode disabled. Will repeatedly update each widget and each iteration will display the latest version on the external display. If the package is missing, will run in test mode, saving the generated canvas images to the working directory. + + Or manually enable test mode: + $ python EinkPaper.py -t + or + $ python EinkPaper.py --test \ No newline at end of file