batmon.sh bugfix + housekeeping

This commit is contained in:
Shaun Inman 2023-03-21 20:21:18 -04:00
parent 1ea75a50e0
commit 0f75041c09
4 changed files with 26 additions and 65 deletions

View file

@ -40,11 +40,11 @@ Following Instructions 101
----------------------------------------
Install
MinUI is meant to be installed over a working stock TF1. The official Anbernic image requires a 64GB SD card:
MinUI is meant to be installed over a working stock TF1. The official Anbernic image requires a 64GB or larger SD card:
https://drive.google.com/drive/folders/1HfGCxkratM_zYiYfGWCrHZ1AynO3hIwU
Or you can download a reduced image that can be flashed to a 4GB SD card:
Or you can download a reduced image that can be flashed to a 4GB or larger SD card:
https://github.com/shauninman/union-minui/releases/tag/stock-tf1-20230309
@ -66,7 +66,9 @@ Shortcuts
Reduce/increase brightness:
MENU + VOLUME UP or VOLUME DOWN
MENU + VOLUME UP or VOLUME DOWN
The remaining emulation shortcuts are all user defined.
----------------------------------------
Roms

View file

@ -2,21 +2,23 @@
touch /mnt/sdcard/batmon.txt
while :; do
O=`cat /sys/class/power_supply/battery/charger_online`
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;
# should match POW_updateBatteryStatus() in api.c
M=$(($V/10000))
M=$(($M-310))
if [ $M -gt 80 ]; then M=100;
elif [ $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
echo "$C ($O:$M) $V $N" >> /mnt/sdcard/batmon.txt
sync
sleep 5
done