Battery charge was mistakenly being computed because values used in computation were defined in a function which was not included as a header file.