this was a challenge in design a circuit to get approx. lenght of the cable depending on resistance and EMI field it may require a complicated firmware but its a solution for some troubleshooting
3d design link