feat: add shared tilt-down hide and current-angle measurement

This commit is contained in:
Blendman974 committed 2026-11-06 22:01:21 +01:00
1 parent 5929259d84
commit f029e3ce91
21 files changed
+356 -24

No files matched your search

+14
View File
@@ -51,3 +51,17 @@ On the target glasses, record both lens firmware versions and test:
6. Check both lenses remain synchronized, including reconnecting only one arm.
Do not change firmware to run these checks without explicit permission.
## Shared tilt-down hide and current-angle estimate
Inspired by [Faceclaw PR #64](https://github.com/jimrandomh/faceclaw/pull/64), Display settings now include one Tilt down to hide toggle (off by default), used by both the regular glasses UI and Glanceboard. HEAD_DOWN is forwarded by the existing firmware (event 15, Faceclaw/38), consumed before input filtering/activity tracking, and never wakes the screen. With the option enabled it dismisses Glanceboard and sleeps the regular UI, including after a manual wake. The action is an explicit sleep gesture, like manually turning the display off. With the option disabled, it is ignored, preserving prior behavior.
A Glanceboard shown by head-up uses a 60-second safety limit when Tilt down to hide is enabled; otherwise the existing tap timeout is retained. Show on head tilt still selects what appears on wake. There are no separate Glanceboard angle/hide preferences. iOS consumes the shared HEAD_DOWN event so it cannot become spurious input; current-angle measurement remains Android-only.
Set to current head angle performs a short experimental IMU measurement, then stores the result in the existing shared Head-up angle preference. It reads the glasses' restored calibration (settings request field 9) and subtracts it before saving the raw firmware angle. Existing raw-angle preferences and untouched fields keep their original meaning. A temporary native IMU lease restores the latest application request, including changes made during measurement. Sampling uses one temple only; ring readings, non-finite/zero vectors, unstable samples and unsupported offsets are rejected. Failures leave the saved angle unchanged. Existing synchronization sends the result to both lenses and restores it on reconnect.
Important measurement limitation: PR #64's dominant-axis inclination estimate is approximate, includes side tilt, and cannot disambiguate a dominant-axis swap beyond 45 degrees. The menu explicitly marks it experimental and asks for a moderate angle below 45 degrees with the head level sideways. It does not claim hardware-calibrated pitch; the manual 0–60 degree control remains available. Firmware calibration is not rewritten. Do not rely on software tests alone for physical angle accuracy.
Additional software coverage: shared preference persistence; controller routing with the display awake/asleep and the option on/off; Glanceboard safety timeout; measurement success/failure, concurrent calls, missing/moving sensors, ring exclusion and cleanup; calibration protocol zero/signed/missing fields; native IMU lease restoration; native HEAD_DOWN forwarding without user activity.
Extended independent validation: 1070 JavaScript tests passed, 2 skipped; 272 Kotlin Android host tests passed; TypeScript and changed-source lint passed. Physical wake, hide and angle accuracy remain unverified on glasses.