I implemented and tested this last night; While the calculation in the m5core2 factory test is linear - the battery performance is not.

My little Core2 lasted for 5 hours and 40 minutes.

At about 5 hours and 25 minutes it was showing 20% (my battery meter turns red at 20% :) ), but the last 20% dropped off in 15 minutes. You can see this shown in the graph above for Li-ion batteries (i dont really know how close that is to the real performance of these batteries.

We can extrapolate that as being a total life of 1 hour and 15 minutes - based onthe last 20%

Does anyone know of a better curve solution someone has already done?

If not I know the solution:

Leave it to run down, pinging out to sdcard its battery voltage, current draw (for information) and the time elapsed.

Then we can build a graph - just like the one I linked to based on the specific battery in this device - a new, healthy battery at room temperature - using a fairly normal level of power consumption.

Then I can build a lookup table to represent this in code for this device.

We could also build tables at different consumptions/temperatures if we wish as this will all affect when the "last 20%" fade kicks in. Upshot would be it will be much more accurate than this basic linear calculation is - so I'm going to do this later.