Commit f42714f7 authored by Martin Kepplinger's avatar Martin Kepplinger
Browse files

add batmon.sh

parent 4f4bd442
#!/bin/bash
BQ=/sys/class/power_supply/bq25890-charger/
# i2ctransfer -f -y 3 w3@0x36 0xdb 0x00 0x80
while true; do
A_AVG=$(cat /sys//class/power_supply/max170xx_battery/current_avg )
CAP=$( cat /sys//class/power_supply/max170xx_battery/capacity)
CHARGE_FULL=$(cat /sys//class/power_supply/max170xx_battery/charge_full)
CHARGE_NOW=$(cat /sys//class/power_supply/max170xx_battery/charge_now)
V_NOW=$(cat /sys//class/power_supply/max170xx_battery/voltage_now)
TEMP=$(cat /sys/class/power_supply/max170xx_battery/temp)
BQ_CHARGE=$(cat $BQ/status)
BQ_CURRENT=$(cat $BQ/constant_charge_current)
BQ_VOLTAGE=$(cat $BQ/constant_charge_voltage)
TIME=$(uptime | awk '{print $3}')
echo $TIME:$A_AVG uA:$CAP %:$CHARGE_NOW mAh:$CHARGE_FULL mAh:$V_NOW V:$TEMP C, $BQ_CHARGE, charge current: $BQ_CURRENT uA, $BQ_VOLTAGE uV
for i in {0..20}; do
val=$(i2cget -y -f 3 0x6a $i)
printf "%.2x:%.2x " $i $val
done
printf "\n"
sync
sleep 1
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment