Properly detect rising and falling pulses in interrupt, and also track when we get a timeout (distance is out of range)