mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
When one pod is out of the case, the out-of-case pod broadcasts bit4-only frames whose lid byte is stale and decodes to a phantom OPEN even while the case is shut, interleaved ~1:1 with the correct in-case-pod (bit6) frames. The derived lid state flapped OPEN<->CLOSED, so the case-open popup re-popped ~0.5s after closing and sometimes lingered. Verified on AirPods Pro 1 (issue log) and Pro 3 (live BLE capture). - Trust the lid bit only from in-case-pod (bit6) or both-in-case (bit2) frames; bit4-only frames now decode to UNKNOWN, and the real state is recovered from a recent in-case broadcast (matches LibrePods). - getLatestCaseLidState recovers from history within a 2s age window instead of a fixed frame count, so a missed CLOSED can't keep a stale OPEN. - Don't refresh the show-cooldown on a non-CLOSED hide, so a transient UNKNOWN can't suppress a genuine re-open. - Add a freshness backstop: dismiss the popup if a fresh OPEN broadcast stops arriving (device left BLE range while open). - Key popup/auto-connect de-duplication on the derived lid state, not just raw advertisement bytes, since the effective lid can change while bytes don't. Closes #598