But my question was if you know a better way with only one interrupt
I think his approach is quite convoluted - C10 for example only serves to tell time, which the mcu can do with ease.
The basic theory here is that when you charge up a capacitor with a constant current, the voltage rise
deltaV = I * Tc / C, assuming deltaV is sufficiently small and ESR is sufficiently small.
When you discharge, the residual voltage at Td is
Vd = deltaV * exp(-Td / (ESR * C)).
So after each charge/discharge cycle, the voltage across the capacitor has gone up by Vd.
If, after n such cycles, the voltage across the capacitor is V, you have
V/n = (I * Tc / C) * exp (-Td / (ESR * C)), assuming of course V is sufficiently small.
If you know V, n, I, Tc, Td, C, you can solve for ESR from the above.
You can take his hardware, and you can rewrite the software:
1) charge the capacitor at I for Tc;
2) discharge the capacitor for Td;
3) go back to 1 for n times;
4) measure the voltage across the capacitor, V;
5) calculate ESR.
No need to have a comparator.