From 092cb60702ac8e01ff001c33ff02cb82125ad5ca Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Sat, 6 Nov 2021 17:23:53 -0700 Subject: [PATCH] Handle the screen rotation parameter better, fixing an error when no parameter was specified (#418) --- src/oled_monitor/rascsi_oled_monitor.py | 2 ++ src/oled_monitor/start.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/oled_monitor/rascsi_oled_monitor.py b/src/oled_monitor/rascsi_oled_monitor.py index 3d9512b9..7f329b78 100755 --- a/src/oled_monitor/rascsi_oled_monitor.py +++ b/src/oled_monitor/rascsi_oled_monitor.py @@ -65,8 +65,10 @@ print("Will update the OLED display every " + str(DELAY_TIME_MS) + "ms (approxim if len(argv) > 1: if str(argv[1]) == "0": ROTATION = 0 + print("Using 0 degrees screen rotation.") elif str(argv[1]) == "180": ROTATION = 2 + print("Using 180 degrees screen rotation.") else: exit("Only 0 and 180 are valid arguments for screen rotation.") else: diff --git a/src/oled_monitor/start.sh b/src/oled_monitor/start.sh index e48b63df..acc46b67 100755 --- a/src/oled_monitor/start.sh +++ b/src/oled_monitor/start.sh @@ -105,5 +105,10 @@ while [ "$1" != "" ]; do shift done -echo "Starting OLED Screen with $ROTATION degrees rotation..." -python3 rascsi_oled_monitor.py "${ROTATION}" +echo "Starting OLED Screen..." +if [ -z ${ROTATION+x} ]; then + echo "No screen rotation parameter given; falling back to the default." +else + echo "Screen rotation set to $ROTATION degrees." +fi +python3 rascsi_oled_monitor.py ${ROTATION}