From a6a66a02658119eea5047dd1260a4ecec617c75c Mon Sep 17 00:00:00 2001 From: Larry Brown Date: Tue, 3 Jan 2023 10:02:09 -0500 Subject: [PATCH 1/3] Update ser2bt_config.ini Added instructions to the configuration file. and set the colors and orientation to default. --- ser2bt_config.ini | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ser2bt_config.ini b/ser2bt_config.ini index cee1c71..764b5fa 100644 --- a/ser2bt_config.ini +++ b/ser2bt_config.ini @@ -1,9 +1,13 @@ +#instructions: +# screen rotation - 0 = normal orientation; 180 = upside down. +# for the color options: 255 = white; 0 = black. +# Default is normal orientation; black text over white background. [screen] -screen_rotate=180 +screen_rotate=0 foreground=0 background=255 [shutdown_screen] -screen_rotate=180 +screen_rotate=0 foreground=0 -background=255 \ No newline at end of file +background=255 From 01c22534d0064c10286373bbc22968f497ca6bf3 Mon Sep 17 00:00:00 2001 From: Larry Brown Date: Tue, 3 Jan 2023 10:17:43 -0500 Subject: [PATCH 2/3] For when the screen is set to dark mode For when the text is set to white text over black background. --- logo_inverted.bmp | Bin 0 -> 26026 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 logo_inverted.bmp diff --git a/logo_inverted.bmp b/logo_inverted.bmp new file mode 100644 index 0000000000000000000000000000000000000000..963c01b0b784bae7cf9b14b00cad285bd797e98b GIT binary patch literal 26026 zcmeI3J(46R5Jpji3>^bgCy-6Z*BwwObORlLqhKgx=oHvGgA9(awq%SRN&QoFQ;ec# zx|i;G1(on6nF-a?yBquCPk;WZr zP~q>OzWnuvQrdt82DFC&Q7NN9107?*frkK5DXTz(0dA}V4*}w|uBJ6$!GVVWQ7O90 zYcOEJfrkK*AQfmZV8MZh08uG^RMcR=f&&i$qB4pwm4@`T;J`zGm{Zf5)_?^E9s4k{0}laWE|=4^1}r%65FqAKdQEGX2)U?f4OnpCAwX1t{Dab9 zz=8u0=^gXY(wf$Q1qU7i#C+_GrZr%}frkJwA4#ie4OnpCAwbN>)oEG-794m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*0l8@U%1 g=qzX9XBb8WMg>L%Mg>L%Mg>L%Mg>L%o~{D_0iR+O$p8QV literal 0 HcmV?d00001 From 725f52ff8577a25aa6a3272c5053feea12a3ca11 Mon Sep 17 00:00:00 2001 From: lgbrownjr Date: Tue, 3 Jan 2023 12:37:51 -0500 Subject: [PATCH 3/3] Changes: Adding a inverted color logo, updated the ini to reflect init screen, shutdown screen, and main screen rotation/color options; updated the init_scr file to read and accept input from the ini file; added logic to the shutdown_scr file to use the regular or inverted color graghic, based on the setting of the text(forground); All this exposed 2 bugs in the upgrade file: was not putting the graphic files in the correct subdirectory; noted that the upgrade utility was overwriting the config (ini) file. added logic to check for existance as apposed to match the file with the default. --- init_scr | 16 ++++++++++++---- ser2bt_config.ini | 5 +++++ shutdown_scr | 5 ++++- upgrade | 37 +++++++++++++++++++------------------ 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/init_scr b/init_scr index ed74693..8c05f06 100755 --- a/init_scr +++ b/init_scr @@ -4,11 +4,19 @@ from PIL import Image, ImageDraw, ImageFont # Font handeling from waveshare_epd import epd2in13_V2 import os +import configparser #to handle the config file. from ser2bt_lib import line_pos, center_text -#user-changable settings. -screen_rotate = 180 -foreground = 0 -background = 255 +#import configuration file: +#Read ser2bt_config.ini file +config_obj = configparser.ConfigParser() +config_obj.read("/etc/ser2bt_config.ini") +screen = config_obj["screen"] +init_screen = config_obj["init_screen"] + +# parameters to use the keys from the ser2bt_config.ini +screen_rotate = int(screen["screen_rotate"]) +foreground = int(screen["foreground"]) +background = int(screen["background"]) # Variable decleration epd = epd2in13_V2.EPD() diff --git a/ser2bt_config.ini b/ser2bt_config.ini index 764b5fa..b2fc752 100644 --- a/ser2bt_config.ini +++ b/ser2bt_config.ini @@ -7,6 +7,11 @@ screen_rotate=0 foreground=0 background=255 +[init_screen] +screen_rotate=0 +foreground=0 +background=255 + [shutdown_screen] screen_rotate=0 foreground=0 diff --git a/shutdown_scr b/shutdown_scr index 7d148a6..09cb821 100755 --- a/shutdown_scr +++ b/shutdown_scr @@ -37,7 +37,10 @@ f_top_line_font16 = ImageFont.truetype(roboto_font_dir+'Roboto-Medium.ttf', 16) f_title_font18 = ImageFont.truetype(roboto_font_dir+'Roboto-Bold.ttf', 18) f_title_font24 = ImageFont.truetype(roboto_font_dir+'Roboto-Bold.ttf', 24) -bmp = Image.open(os.path.join(picdir, 'logo.bmp')) +if foreground == 0: + bmp = Image.open(os.path.join(picdir, 'logo.bmp')) +else: + bmp = Image.open(os.path.join(picdir, 'logo_inverted.bmp')) exit_image = Image.new('1', (epd.height, epd.width), int(background)) #clear the frame exit_draw = ImageDraw.Draw(exit_image) left_margin = 1 #Left margin. diff --git a/upgrade b/upgrade index 0e80d0c..b1fc1cd 100755 --- a/upgrade +++ b/upgrade @@ -56,9 +56,9 @@ wavesh_bin_files=(ser2bt_status init_scr shutdown_scr ser2bt_lib.py) full_bin_files=( "${base_bin_files[@]}") pisugar2_bin_files=(button_detect bat_mon) ups_lite_bin_files=(bat_mon) -base_lib_files=(format.sh) -ser2bt_lib_files=(logo.bmp) -full_lib_files=( "${base_lib_files[@]}") +base_lib_files=("format.sh") +ser2bt_lib_files=("logo.bmp" "logo_inverted.bmp") +full_lib_files=( "${base_lib_files[@]}") #The script will determine what should get added to base_lib_files later on: etc_files=(ser2bt_bridge.screenrc) wavesh_etc_files=(ser2bt_config.ini) base_service_files=(rfcomm.service) @@ -292,7 +292,7 @@ fi if [ "${upgrade_path}" = "enhanced" ] ; then bin_files=(${base_bin_files[@]}) - lib_files=(${enhanc_lib_files[@]}) + lib_files=(${base_lib_files[@]}) #The script will determine what should get added to base_lib_files later on: service_files=(${enhanc_service_files[@]}) service_assoc=(${enhanc_service_assoc[@]}) config_txt_addons=(${enhanc_config_txt_addons[@]}) @@ -304,7 +304,7 @@ fi if [ "${upgrade_path}" = "full" ] ; then bin_files=(${full_bin_files[@]}) - lib_files=(${base_lib_files[@]}) + lib_files=(${base_lib_files[@]}) #The script will determine what should get added to base_lib_files later on: service_files=(${full_service_files[@]}) service_assoc=(${full_service_assoc[@]}) config_txt_addons=(${full_config_txt_addons[@]}) @@ -373,7 +373,7 @@ if [ "${e_ink}" = "True" ] && [ "${upgrade_path}" = "full" ] ; then config_txt_values=("${config_txt_values[@]}" "${wavesh_config_txt_values[@]}") boot_search=("${boot_search[@]}" "${wavesh_boot_search[@]}") bin_files=("${bin_files[@]}" "${wavesh_bin_files[@]}") - lib_files=("${lib_files[@]}" "${ser21bt_lib_files[@]}") +# lib_files=("${lib_files[@]}" "${ser2bt_lib_files[@]}") etc_files=("${etc_files[@]}" "${wavesh_etc_files[@]}") service_files=("${service_files[@]}" "${wavesh_service_files[@]}") service_assoc=("${service_assoc[@]}" "${wavesh_service_assoc[@]}") @@ -651,21 +651,22 @@ done fi done -if [ "${e_ink}" = "True" ] && [ "${upgrade_path}" = "Full" ] ; then - printf "\nCopying files to the ${cyn}${ser2bt_lib_folder} ${nor}directory:\n" - for file in "${ser2bt_lib_files[@]}" ; do - if cmp --silent "${ser2bt_lib_folder}${file}" "${project_folder}${file}" ; then - printf " ${nor}Both versions of ${yel}${file} ${nor}are the same, Skipping...\n" - else - cp ${project_folder}${file} ${ser2bt_lib_folder} && printf " ${yel}${file} ${nor}copied.\n" || break - fi - done -fi + if [ "${e_ink}" = "True" ] && [ "${upgrade_path}" = "full" ] ; then + printf "\nCopying files to the ${cyn}${ser2bt_lib_folder} ${nor}directory:\n" + for file in "${ser2bt_lib_files[@]}" ; do + if cmp --silent "${ser2bt_lib_folder}${file}" "${project_folder}${file}" ; then + printf " ${nor}Both versions of ${yel}${file} ${nor}are the same, Skipping...\n" + else + cp ${project_folder}${file} ${ser2bt_lib_folder} && printf " ${yel}${file} ${nor}copied.\n" || break + fi + done + fi printf "\nCopying files to the ${cyn}${etc_folder} ${nor}directory:\n" for file in "${etc_files[@]}" ; do - if cmp --silent "${etc_folder}${file}" "${project_folder}${file}" ; then - printf " ${nor}Both versions of ${yel}${file} ${nor}are the same, Skipping...\n" + if [ -e "${etc_folder}${file}" ]; then +# if cmp --silent "${etc_folder}${file}" "${project_folder}${file}" ; then + printf " ${yel}${file}${nor} already exists, Skipping...\n" else cp ${project_folder}${file} ${etc_folder} && printf "${yel}${file} ${nor}copied.\n" || break fi