It’s essentially the same.
The issue we have is that there is no way to detect a gen2 battery from an older gen1 battery. Gen2 batteries have a much flatter discharge curve, voltage will drop quickly during perhaps last 15% of capacity. We could have tried to add some fancy code looking at voltage over time, but in the end we just decided to keep it simple and do what we did in gen1.
// full range 6400mV to 8200mV
int32_t percent = (volts - 6400) / 18;
// limit to 5% increments
percent = (percent / 5) * 5;
if( percent > 95 ) percent = 100;
if( percent < 5 ) percent = 5;