Figure 1 - Battery Charging Algorithm