When entering the low power state, you should save the RepSOC and RepCap values to the system NV memory.
When waking up, look at the value of MixCap and MixSOC.
If MixSOC is lower than RepSOC saved by more than 3%, then write RepCap = MixSOC x FullCapRep, and RepSOC = MixSOC.
If MixSOC is not lower than the saved RepSOC value, then restore the RepCap and RepSOC back.
The effect is that any drift will be erased by restoring the RepCap and RepSOC, while longer storage cases where the battery has discharged either through self discharge or through the system, the RepSOC will be decreased to the value of MixSOC.