aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/bin/bat-safecharge
blob: 1fdabe79f1a57feff612908b7721860f3462e014 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash

# To make this persistent:
# sudo apt-get install sysfsutils
# edit /etc/sysfs.d/76-safe_charge.conf
# add:
# class/power_supply/BAT0/charge_control_start_threshold = 60
# class/power_supply/BAT0/charge_control_end_threshold = 81

sudo bash -c "echo 30 >/sys/class/power_supply/BAT0/charge_control_start_threshold"

## Set to 81 so it settles at 80.xx rather than stopping at 80.00 (and 
## immediatly drop to 79)
# Read online that Lenovo engineers suggest that between 40-60 will give the best
# support for maintaining the life of the battery.
sudo bash -c "echo 50 >/sys/class/power_supply/BAT0/charge_control_end_threshold"

echo "Safe Charge Enabled - 50%"