How to determine whether a capacitor is discharged