After replacing the cells in a laptop's battery, its bms needs a few charge-discharge cycles to pick up the new capacity. This script automates this task while monitoring for overcharge and overdischarge, as my bms decided overcharging the cells up to 4.3 volts would be a nice revenge for making it work after early retirement.
- amber (optional)
- gum (prompts and stuff)
- bc (used by amber to make math work)
- stress-ng (speeds up discharge cycles a bit)
It's more or less interactive, so should be pretty understandable. Run it with either sudo amber batcal.ab
or sudo ./batcal.sh
(which is the same but compiled. Probably should put it into releases but whatever)