Handle the screen rotation parameter better, fixing an error when no parameter was specified (#418)

This commit is contained in:
Daniel Markstedt 2021-11-06 17:23:53 -07:00 committed by GitHub
parent 562f1f0d6a
commit 092cb60702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -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:

View File

@ -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}