Glad it works.
Hope you also understand what's going on, as it showcases two basic techniques that come back time and again: millis() based non-blocking timing, and a very basic finite state machine having just two states: measuring and not measuring.