From a5429f82d78663b1f201ae590894d42093ad1006 Mon Sep 17 00:00:00 2001 From: aceisace Date: Thu, 14 Apr 2022 06:38:22 +0200 Subject: [PATCH] updated driver files for 7.8", 9.7" and 10.3" parallel epaper displays --- inkycal/display/drivers/10_in_3.py | 48 ++++++++++++++++++++++++++ inkycal/display/drivers/7_in_8.py | 55 +++++++++++++++--------------- inkycal/display/drivers/9_in_7.py | 25 +++++++------- 3 files changed, 87 insertions(+), 41 deletions(-) create mode 100644 inkycal/display/drivers/10_in_3.py diff --git a/inkycal/display/drivers/10_in_3.py b/inkycal/display/drivers/10_in_3.py new file mode 100644 index 0000000..5e6eea2 --- /dev/null +++ b/inkycal/display/drivers/10_in_3.py @@ -0,0 +1,48 @@ +#!python3 +""" +10.3" driver class +Copyright by aceisace +""" +from subprocess import run +from inkycal.custom import image_folder, top_level +from os.path import exists +from PIL import Image + +# Display resolution +EPD_WIDTH = 1872 +EPD_HEIGHT = 1404 + +# Please insert VCOM of your display. The Minus sign before is not required +VCOM = "2.0" + +driver_dir = top_level + '/inkycal/display/drivers/parallel_drivers/' + +command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}' + +class EPD: + + def __init__(self): + """10.3" epaper class""" + pass + + def init(self): + pass + + def display(self, command): + """displays an image""" + try: + run_command = command.split() + run(run_command) + except: + print("oops, something didn't work right :/") + + def getbuffer(self, image): + """ad-hoc""" + image = image.rotate(90, expand=True) + image.convert('RGB').save(image_folder + 'canvas.bmp', 'BMP') + command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}' + print(command) + return command + + def sleep(self): + pass diff --git a/inkycal/display/drivers/7_in_8.py b/inkycal/display/drivers/7_in_8.py index 61462f4..ae643da 100644 --- a/inkycal/display/drivers/7_in_8.py +++ b/inkycal/display/drivers/7_in_8.py @@ -1,10 +1,10 @@ -#!/usr/bin/python3 -# -*- coding: utf-8 -*- +#!python3 """ 7.8" parallel driver class Copyright by aceisace """ -from inkycal.custom import top_level, images +from subprocess import run +from inkycal.custom import image_folder, top_level from os.path import exists from PIL import Image @@ -15,36 +15,35 @@ EPD_HEIGHT = 1404 # Please insert VCOM of your display. The Minus sign before is not required VCOM = "2.0" -driver_dir = top_level+'/inkycal/display/drivers/7_in_8_drivers/' +driver_dir = top_level + '/inkycal/display/drivers/parallel_drivers/' + +command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}' -command = f'sudo {driver_dir}IT8951/IT8951 0 0 {images+"canvas.bmp"}' -print(command) class EPD: - def __init__(self): - """7.8" epaper class""" - pass + def __init__(self): + """7.8" epaper class""" + pass - def init(self): - pass + def init(self): + pass - def display(self, command): - """displays an image""" - try: - run_command = command.split() - run(run_command) - except: - print("oops, something didn't work right :/") + def display(self, command): + """displays an image""" + try: + run_command = command.split() + run(run_command) + except: + print("oops, something didn't work right :/") - def getbuffer(self, image): - """ad-hoc""" - image = image.rotate(90, expand=True) - image.convert('RGB').save(images+'canvas.bmp', 'BMP') - command = f'sudo {driver_dir}IT8951/IT8951 0 {images+"canvas.bmp"}' - print(command) - return command - - def sleep(self): - pass + def getbuffer(self, image): + """ad-hoc""" + image = image.rotate(90, expand=True) + image.convert('RGB').save(image_folder + 'canvas.bmp', 'BMP') + command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}' + print(command) + return command + def sleep(self): + pass diff --git a/inkycal/display/drivers/9_in_7.py b/inkycal/display/drivers/9_in_7.py index 22c63bd..f9e0968 100644 --- a/inkycal/display/drivers/9_in_7.py +++ b/inkycal/display/drivers/9_in_7.py @@ -1,10 +1,10 @@ #!python3 - """ 9.7" driver class Copyright by aceisace """ -from inkycal.custom import images, top_level +from subprocess import run +from inkycal.custom import image_folder, top_level from os.path import exists from PIL import Image @@ -12,20 +12,19 @@ from PIL import Image EPD_WIDTH = 1200 EPD_HEIGHT = 825 -driver_dir = top_level + '/inkycal/display/drivers/9_in_7_drivers/' +# Please insert VCOM of your display. The Minus sign before is not required +VCOM = "2.0" + +driver_dir = top_level + '/inkycal/display/drivers/parallel_drivers/' + +command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}' class EPD: def __init__(self): """9.7" epaper class""" - # Check if zipped folders are present, if yes, assume - # drivers have not been installed yet - - if exists(f'{driver_dir}IT8951.zip'): - print('Additional steps are required to install drivers for 9.7" E-Paper. ' - 'Please run the following command in Terminal, then retry:\n' - f'bash {driver_dir}install.sh') + pass def init(self): pass @@ -41,9 +40,9 @@ class EPD: def getbuffer(self, image): """ad-hoc""" image = image.rotate(90, expand=True) - image.convert('RGB').save(images + 'canvas.bmp', 'BMP') - command = 'sudo {}IT8951/IT8951 0 0 {}'.format(driver_dir, images + 'canvas.bmp') - # print(command) + image.convert('RGB').save(image_folder + 'canvas.bmp', 'BMP') + command = f'sudo {driver_dir}epd -{VCOM} 0 {image_folder + "canvas.bmp"}' + print(command) return command def sleep(self):