From 50c77e729dd65aaf1da70c0d0f043b4a39683b9c Mon Sep 17 00:00:00 2001 From: IncredibleZuess Date: Sat, 9 Nov 2024 18:33:24 +0200 Subject: [PATCH] Fixed up some of the weird cases for image loading and modified the install script to include the 2in7 display --- display.py | 5 +++++ install_bjorn.sh | 2 ++ shared.py | 5 +++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/display.py b/display.py index 12d40ba..cab3173 100644 --- a/display.py +++ b/display.py @@ -33,6 +33,7 @@ class Display: def __init__(self, shared_data): """Initialize the display and start the main image and shared data update threads.""" self.shared_data = shared_data + self.config = self.shared_data.config self.shared_data.bjornstatustext2 = "Awakening..." self.commentaire_ia = Commentaireia() self.semaphore = threading.Semaphore(10) @@ -315,6 +316,10 @@ class Display: draw.text((int(35 * self.scale_factor_x), int(65 * self.scale_factor_y)), self.shared_data.bjornstatustext, font=self.shared_data.font_arial9, fill=0) draw.text((int(35 * self.scale_factor_x), int(75 * self.scale_factor_y)), self.shared_data.bjornstatustext2, font=self.shared_data.font_arial9, fill=0) + #Gonna just roll with the bmp at the moment for the 2in7 display please replace with a resizable format + if (self.config["epd_type"]) == "epd2in7": + image.paste(self.shared_data.frise, (int(20 * self.scale_factor_x), int(160 * self.scale_factor_y))) + image.paste(self.shared_data.frise, (int(0 * self.scale_factor_x), int(160 * self.scale_factor_y))) draw.rectangle((1, 1, self.shared_data.width - 1, self.shared_data.height - 1), outline=0) diff --git a/install_bjorn.sh b/install_bjorn.sh index 4ca2702..2531a1b 100644 --- a/install_bjorn.sh +++ b/install_bjorn.sh @@ -531,6 +531,7 @@ main() { echo "2. epd2in13_V2" echo "3. epd2in13_V3" echo "4. epd2in13_V4" + echo "5. epd2in7" while true; do read -p "Enter your choice (1-4): " epd_choice @@ -539,6 +540,7 @@ main() { 2) EPD_VERSION="epd2in13_V2"; break;; 3) EPD_VERSION="epd2in13_V3"; break;; 4) EPD_VERSION="epd2in13_V4"; break;; + 5) EPD_VERSION="epd2in7"; break;; *) echo -e "${RED}Invalid choice. Please select 1-4.${NC}";; esac done diff --git a/shared.py b/shared.py index ca0e9fc..90d25e6 100644 --- a/shared.py +++ b/shared.py @@ -179,8 +179,8 @@ class SharedData: self.epd_helper = EPDHelper(self.epd_type) if self.config["epd_type"] == "epd2in7": logger.info("EPD type: epd2in7 screen reversed") - # self.screen_reversed = False - # self.web_screen_reversed = False + self.screen_reversed = False + self.web_screen_reversed = False if self.config["epd_type"] == "epd2in13_V2": logger.info("EPD type: epd2in13_V2 screen reversed") self.screen_reversed = False @@ -199,6 +199,7 @@ class SharedData: def initialize_variables(self): """Initialize the variables.""" self.should_exit = False + self.web_screen_reversed = False self.screen_reversed = False self.display_should_exit = False self.orchestrator_should_exit = False