Skip to content

Commit

Permalink
Update led_sys.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle committed Apr 13, 2024
1 parent 0cc14d4 commit 3a56968
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions led_sys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ MODIFIER=$3
DEBUG=$4

if [ "$TYPE" == "" ]; then
echo "OpenHD LED Control"
echo "__________________"
echo "usage:"
echo "led TYPE COLOR DELAY DEBUG"
echo "available types:"
echo "________________"
echo "on|off|manual|warning|error"
echo "OpenHD LED Control"
echo "__________________"
echo "usage:"
echo "led TYPE COLOR DELAY DEBUG"
echo "available types:"
echo "________________"
echo "on|off|manual|warning|error"
fi

# #kill all previous instances
# Kill all previous instances
pgrep -f led_sys.sh | grep -v $$ | xargs --no-run-if-empty kill -9

debugMessage() {
Expand All @@ -38,8 +38,8 @@ elif grep -q "Raspberry Pi" /proc/cpuinfo; then
debugMessage "Only One LED"
fi
elif [ ! -d /sys/class/leds/user-led/brightness ]; then
PLATFORM="cm3"
debugMessage "Only One LED"
PLATFORM="cm3"
debugMessage "Only One LED"
fi

# Main functions
Expand Down Expand Up @@ -81,7 +81,7 @@ LED_ON() {
echo 1 > /sys/class/leds/openhd-x20dev:blue:usr/brightness
debugMessage "White LED on"
else
#set it to white if no or wrong argument is passed
# Set it to white if no or wrong argument is passed
echo 1 > /sys/class/leds/openhd-x20dev:red:usr/brightness
echo 1 > /sys/class/leds/openhd-x20dev:green:usr/brightness
echo 1 > /sys/class/leds/openhd-x20dev:blue:usr/brightness
Expand Down Expand Up @@ -112,6 +112,7 @@ LED_ON() {
echo 1 > /sys/class/leds/user-led/brightness
echo 1 > /sys/class/leds/pi-led-green/brightness
echo 1 > /sys/class/leds/pwr-led-red/brightness
fi
fi
}

Expand Down Expand Up @@ -144,7 +145,7 @@ LED_OFF() {
echo 0 > /sys/class/leds/openhd-x20dev:blue:usr/brightness
debugMessage "White LED off"
else
#set it to white if no or wrong argument is passed
# Set it to white if no or wrong argument is passed
echo 0 > /sys/class/leds/openhd-x20dev:red:usr/brightness
echo 0 > /sys/class/leds/openhd-x20dev:green:usr/brightness
echo 0 > /sys/class/leds/openhd-x20dev:blue:usr/brightness
Expand Down Expand Up @@ -175,6 +176,7 @@ LED_OFF() {
echo 0 > /sys/class/leds/user-led/brightness
echo 0 > /sys/class/leds/pi-led-green/brightness
echo 0 > /sys/class/leds/pwr-led-red/brightness
fi
fi
}

Expand Down Expand Up @@ -239,7 +241,6 @@ BLINK_LED_ASYNC_MULTI_SWITCHING() {
done
}


# LED mode Selection
if [ "$TYPE" == "on" ]; then
LED_ON
Expand Down

0 comments on commit 3a56968

Please sign in to comment.