diff --git a/scripts/blinky-feed.sh b/scripts/blinky-feed.sh index df50c1e..46d2207 100755 --- a/scripts/blinky-feed.sh +++ b/scripts/blinky-feed.sh @@ -9,22 +9,23 @@ blinky_mode="morph" blinky_duration="2500" # temperature -max_temp="85000" -crit_temp="90000" +max_temp="65000" +crit_temp="70000" threshold_upper="66" threshold_lower="33" thermal_zones=( - "*" + "3" ) -# check for root permissions -[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" && exit 1 - # argument to lowercase arg="${1,,}" # functions +function checkRoot() { + [[ "$EUID" != 0 ]] && printf "error: permission denied!\n" && exit 1 +} + # convert a temperature value to a rgb color value function temperatureToRGB() { [[ ! "$1" ]] && printf "error: did not receive a temperature value to convert to a rgb value\n" && exit 1 @@ -76,6 +77,7 @@ function getTemperature() { # main part case "$arg" in -t|--temp|--temperature) + checkRoot getTemperature temperatureToRGB "$result" sendPOST "color=$result" "mode=$blinky_mode" "duration=$blinky_duration"