diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..8c963f0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "C:\\Program Files\\Python38\\python.exe" +} \ No newline at end of file diff --git a/files/python-scripts/display.py b/files/python-scripts/display.py index 84697c4..6172749 100644 --- a/files/python-scripts/display.py +++ b/files/python-scripts/display.py @@ -17,6 +17,7 @@ from PIL import ImageFont, ImageDraw, Image # load more needed modules import time import sys +import os # load randommodules #from random import randint, gauss @@ -29,11 +30,25 @@ RST_PIN = 25 #Reset CS_PIN = 8 DC_PIN = 24 +# set variables + + + + +# define display settings and create display device serial = spi(device=0, port=0, bus_speed_hz = 8000000, transfer_size = 4096, gpio_DC = DC_PIN, gpio_RST = RST_PIN) device_used = sh1106(serial, rotate=2) #sh1106 +# get udev context context = pyudev.Context() +def prepSystem(): + Path("/data/images").mkdir(parents=True, exist_ok=True) + Path("/data/thumbnails").mkdir(parents=True, exist_ok=True) + Path("/data/mnt_sd").mkdir(parents=True, exist_ok=True) + + + def main(): while True: @@ -43,8 +58,11 @@ def main(): monitor.filter_by('block') for device in iter(monitor.poll, None): if 'ID_FS_TYPE' in device: - term.println('{0} partition {1}'.format(device.action, device.get('ID_FS_LABEL'))) - time.sleep(5) + + + term.println("SD-Card inserted. Starting copy...") + time.sleep(2) + if __name__ == "__main__": try: