refactored battery calculation
This commit is contained in:
parent
5ab4a96b1f
commit
d0d87e4a00
3 changed files with 24 additions and 10 deletions
|
|
@ -2,7 +2,21 @@
|
|||
|
||||
touch /mnt/sdcard/batmon.txt
|
||||
while :; do
|
||||
echo `cat /sys/class/power_supply/battery/capacity` `cat /sys/class/power_supply/battery/voltage_now` `date` >> /mnt/sdcard/batmon.txt
|
||||
C=`cat /sys/class/power_supply/battery/capacity`
|
||||
V=`cat /sys/class/power_supply/battery/voltage_now`
|
||||
M=$(($V/1000))
|
||||
M=$(($M-3300))
|
||||
M=$(($M/8))
|
||||
|
||||
if [ $M -gt 80 ]; then M=100;
|
||||
if [ $M -gt 60 ]; then M=80;
|
||||
elif [ $M -gt 40 ]; then M=60;
|
||||
elif [ $M -gt 20 ]; then M=40;
|
||||
elif [ $M -gt 10 ]; then M=20;
|
||||
else M=10; fi
|
||||
|
||||
N=`date`
|
||||
echo "$C ($M) $V $N" >> /mnt/sdcard/batmon.txt
|
||||
sync
|
||||
sleep 5
|
||||
done
|
||||
|
|
@ -20,7 +20,7 @@ cd $(dirname "$0")
|
|||
|
||||
keymon.elf & # &> /mnt/sdcard/keymon.txt &
|
||||
|
||||
# ./batmon.sh &>
|
||||
# ./batmon.sh &> /mnt/sdcard/batmon.txt &
|
||||
|
||||
export EXEC_PATH=/tmp/minui_exec
|
||||
touch "$EXEC_PATH" && sync
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue