It is table-driven, not a simple full-range linear fit.
We read the battery voltage in millivolts, then convert it to state-of-charge using an open-circuit-voltage table. Between adjacent table entries, the code does linear interpolation.
For the Wio Tracker L1, the OCV table is:
| Charge | Voltage |
|---|---|
| 100% | 4200 mV |
| 90% | 3876 mV |