Time of Flight Remaining

Hey, Im trying to estimate my remaining time of flight for a copter using a current sensor. I want to give initial/total battery size as an input at start, and then use the current to estimate remaining ETR.
Any ideas what fields i would have to change ? what portions of code and where do i put my code in? how do I put it in the scheduler and then display my output on Mission Planner?