Skip to content

Commit

Permalink
- Report whether battery is Charging, Discharging, Not charging, Full.
Browse files Browse the repository at this point in the history
- Operate with 20% charge as long as we're charging (externally powered).
  • Loading branch information
filbo committed Mar 18, 2014
1 parent c841db5 commit 9d376ef
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions NookManager/menu/mainmenu
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ key=0
while [ "$key" -ne "3" ]; do

POWER=`cat /sys/class/power_supply/bq27510-0/capacity`
CHARGING=`cat /sys/class/power_supply/bq27510-0/status`

if [ "$POWER" -lt "40" ]; then
header="System: $SYSTEM\nBattery Level: $POWER\nPlease charge your battery above 40\nand then restart NookManager."
POWERMSG="$POWER%"
[ "" != "$CHARGING" ] && POWERMSG="$POWER%% ($CHARGING)"
header="System: $SYSTEM\nBattery Level: $POWERMSG"

if [ "$POWER" -lt "40" -a \( "$POWER" -lt 20 -o "$CHARGING" != "Charging" \) ]; then
header="$header\nPlease charge your battery above 40%%\n(or 20%% when plugged in to power)\nand then restart NookManager."
button1=
button3="<- Exit"
button2=
button4=
else
header="System: $SYSTEM\nBattery Level: $POWER"
button1="<- Rescue"
button3="<- Exit"
button2="Root ->"
Expand Down

1 comment on commit 9d376ef

@doozan
Copy link

@doozan doozan commented on 9d376ef Mar 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like showing the charging status, but I think we should still leave the requirement at 40% regardless of the charging state. The backup in particular runs at 100% cpu for and extended time and I've seen the battery % decrease even when the charger is on.

Please sign in to comment.