The case statement was causing it to never display that it was charging and some of the awk statements had an off-by-one bug to grab the correct values.