Nice one!
But are you sure that the maximum voltage is 4.2V? While charging, it goes up to some 4.5 - 4.55V and when you disconnect the charger near 100% the voltage is around 4.37 Volts. It goes down to 4.2V only around 90% battery level. They add some chemistry to their Lithium cells to allow such higher voltages being safely used and this way artificially increase capacity. It’s not only on the 10 V but also on the 10 III.
I am recharging my 10 III right now and the voltage (at 88% battery level) is reported as 4.427V and increasing.
and at 95% it is reported as 4.482V
And even after being disconnected from the charger, i.e. in a normal discharging state, the voltage at 98% remains at 4.35 - 4.37 Volts.
I observe the same phenomenon on the 10 V, so I guess that you should check it as it’ll probably take using some higher value than 4.2 Volts as the max voltage corresponding with 100% charge level to get more precise battery level percentage calculation. At least on the 10 III (while normally discharging), 4.2 Volts seem to correspond with battery level of 90% or so, so with 4.2V used as max voltage you actually “lose” some 10%.