mirror of
https://github.com/sipeed/LicheeRV-Nano-Build.git
synced 2026-09-10 20:59:59 -05:00
48 lines
882 B
Bash
Executable File
48 lines
882 B
Bash
Executable File
#!/bin/sh
|
|
|
|
GREEN=0xFF00FF00
|
|
RED=0xFFFF0000
|
|
|
|
case "$1" in
|
|
start)
|
|
printf "Starting temptest: "
|
|
if [ -e /boot/temptest ]
|
|
then
|
|
touch /tmp/temptest
|
|
fi
|
|
(
|
|
while true
|
|
do
|
|
if [ ! -e /tmp/temptest ]
|
|
then
|
|
break
|
|
fi
|
|
colorbg=0xFF000000
|
|
soc_temp=$(cat /sys/class/thermal/thermal_zone0/temp)
|
|
if [ "${soc_temp}" -le 75000 ]
|
|
then
|
|
colorfg=$GREEN
|
|
else
|
|
colorfg=$RED
|
|
fi
|
|
echo "soc temp: $soc_temp" | fbbar 32 $colorfg $colorbg
|
|
colorfg=0xFFFFFFFF
|
|
echo "soc id: $(cat /device_key_legacy)" | fbbar 48 $colorfg $colorbg
|
|
sleep 1
|
|
done
|
|
) &
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
|
;;
|
|
stop)
|
|
printf "Stopping temptest: "
|
|
rm /tmp/temptest
|
|
echo "OK"
|
|
;;
|
|
restart)
|
|
printf "Restart temptest: "
|
|
$(realpath ${0}) stop
|
|
$(realpath ${0}) start
|
|
echo "OK"
|
|
;;
|
|
esac
|