Homebrew DRO code update

Hi all — for those still following Homebrew DRO Display, or those new here, I wanted to share an update to the code for my homebrew DRO.
I ran the code through my local Qwen 3.8 AI system and asked for potential improvements, with performance as my top priority. It came back with some solid enhancements, and the result is a big jump in update speed — around 2ms updates are realistic now.
Here’s what changed:

  • Lower display latency — recv timeout dropped from 5ms to 1ms, and the main loop no longer sleeps while data is arriving, so updates land as fast as the server pushes them.
  • Faster effective refresh — displays now only rewrite when a value actually changes, instead of all five every cycle. Each TM1637 write blocks the loop, so during a single-axis jog this is a major speedup.
  • Auto-reconnect — if the connection to the LinuxCNC box drops, it reconnects, re-auths, and re-subscribes automatically. It also retries at startup, so the Pi can boot before the machine is up.
  • Auth validation — a rejected login now fails loudly instead of silently polling nothing.
  • Timer fix — a stalled velocity stream can no longer keep accumulating cut/rapid time (stale values are reset after 200ms).
  • Cleaner shutdown — the socket and GPIO are properly released on exit.
    The updated .py is attached.
    Regards,
    TP
    dro.py (13.7 KB)