From 8150947cd64879554ceb6fbc7c539e7aafd4244b Mon Sep 17 00:00:00 2001 From: norbert-walter Date: Thu, 24 Jul 2025 14:28:56 +0200 Subject: [PATCH] Fix contrast lost for GDEY042T81 display --- extra_script.py | 14 ++++++++++ lib/obp60task/obp60task.cpp | 56 ++++++++++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/extra_script.py b/extra_script.py index b185a93..dd9a90b 100644 --- a/extra_script.py +++ b/extra_script.py @@ -526,3 +526,17 @@ env.Append( ) #script does not run on clean yet - maybe in the future env.AddPostAction("clean",cleangenerated) + +#look for extra task scripts and include them here +for taskdir in userTaskDirs: + script = os.path.join(taskdir, "extra_task.py") + if os.path.isfile(script): + taskname = os.path.basename(os.path.normpath(taskdir)) + print("#extra task script for '{}'".format(taskname)) + with open(script) as fh: + try: + code = compile(fh.read(), taskname, 'exec') + except SyntaxError: + print("#ERROR: script does not compile") + continue + exec(code) diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 14e5d21..30a79c1 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -421,7 +421,7 @@ void OBP60Task(GwApi *api){ #endif #ifdef DISPLAY_GDEY042T81 - getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse + getdisplay().init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse #else getdisplay().init(115200); // Init for normal displays #endif @@ -747,12 +747,22 @@ void OBP60Task(GwApi *api){ starttime1 = millis(); starttime2 = millis(); getdisplay().setFullWindow(); // Set full update - getdisplay().nextPage(); - if(fastrefresh == "false"){ + if(fastrefresh == "true"){ + getdisplay().nextPage(); // Full update + } + else{ getdisplay().fillScreen(commonData.fgcolor); // Clear display + #ifdef DISPLAY_GDEY042T81 + getdisplay().init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse + #else + getdisplay().init(115200); // Init for normal displays + #endif + getdisplay().firstPage(); // Full update getdisplay().nextPage(); // Full update - getdisplay().fillScreen(commonData.bgcolor); // Clear display - getdisplay().nextPage(); // Full update +// getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update +// getdisplay().fillScreen(commonData.bgcolor); // Clear display +// getdisplay().nextPage(); // Partial update +// getdisplay().nextPage(); // Partial update } delayedDisplayUpdate = false; } @@ -764,12 +774,22 @@ void OBP60Task(GwApi *api){ starttime2 = millis(); LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh first 5 min"); getdisplay().setFullWindow(); // Set full update - getdisplay().nextPage(); - if(fastrefresh == "false"){ + if(fastrefresh == "true"){ + getdisplay().nextPage(); // Full update + } + else{ getdisplay().fillScreen(commonData.fgcolor); // Clear display + #ifdef DISPLAY_GDEY042T81 + getdisplay().init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse + #else + getdisplay().init(115200); // Init for normal displays + #endif + getdisplay().firstPage(); // Full update getdisplay().nextPage(); // Full update - getdisplay().fillScreen(commonData.bgcolor); // Clear display - getdisplay().nextPage(); // Full update +// getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update +// getdisplay().fillScreen(commonData.bgcolor); // Clear display +// getdisplay().nextPage(); // Partial update +// getdisplay().nextPage(); // Partial update } } @@ -778,12 +798,22 @@ void OBP60Task(GwApi *api){ starttime2 = millis(); LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh"); getdisplay().setFullWindow(); // Set full update - getdisplay().nextPage(); - if(fastrefresh == "false"){ + if(fastrefresh == "true"){ + getdisplay().nextPage(); // Full update + } + else{ getdisplay().fillScreen(commonData.fgcolor); // Clear display + #ifdef DISPLAY_GDEY042T81 + getdisplay().init(115200, true, 2, false); // Init for Waveshare boards with "clever" reset circuit, 2ms reset pulse + #else + getdisplay().init(115200); // Init for normal displays + #endif + getdisplay().firstPage(); // Full update getdisplay().nextPage(); // Full update - getdisplay().fillScreen(commonData.bgcolor); // Clear display - getdisplay().nextPage(); // Full update +// getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update +// getdisplay().fillScreen(commonData.bgcolor); // Clear display +// getdisplay().nextPage(); // Partial update +// getdisplay().nextPage(); // Partial update } }