Change Case and add export

This commit is contained in:
thehermit 2017-03-04 20:22:32 +00:00
parent 751c84834f
commit 1642cf2142

View File

@ -28,14 +28,15 @@ check_switch() {
switch3=`cat /sys/class/gpio_sw/PL3/data`
echo "--- switch1 = $switch1, switch2 = $switch2, switch3 = $switch3"
if [ "x$switch1" = "x0" ] && [ "x$switch2" = "x1" ] && [ "x$switch3" = "x1" ]; then
switchposition="switch1"
SWITCH_POSITION="switch1"
elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x0" ] && [ "x$switch3" = "x1" ]; then
switchposition="switch2"
SWITCH_POSITION="switch2"
elif [ "x$switch1" = "x1" ] && [ "x$switch2" = "x1" ] && [ "x$switch3" = "x0" ]; then
switchposition="switch3"
SWITCH_POSITION="switch3"
else
switchposition="invalid"
SWITCH_POSITION="invalid"
fi
}
check_switch
check_switch
export SWITCH_POSITION