1.Split power source detection to a individual function.
2.Optimize the power warning monitor and charge monitor algorithm.
3.Add comments.
4.Still include debug code.
Modify power monitor frequency to 2Hz.
temp