forked from Blendman974/faceclaw
Glanceboard: address review of head-tilt angle and glance down
- A verification read that still disagrees no longer requeues the writes at once (which looped while the firmware refused the value); the next regular poll retries. - "Glasses default" now writes back the glasses' own switch and angle, saved before Faceclaw first changed them (persisted across app restarts), and drops writes still queued. Disabling the Glanceboard does the same. - "Set to current head angle" takes two readings, head level then tilted up, and uses the angle between them, so it no longer depends on the sensor's axes or folds past 45°. A head that did not move is reported, not stored as 5°. The math is in head-tilt-math.ts, with tests. - A head-tilt that woke a suspended session, or a trigger under 25° (where a level gaze stays above the head-down threshold), hides after the tap duration instead of the 60 s cap. The setting's description explains it. - The angle rows are hidden on iOS, which cannot change the setting. - The capture row repaints while measuring, ignores repeat selects, and its status clears when the menu reopens or the angle changes; the angle is sent once, by the controller's settings listener. - Comments describing a head-tilt as a timed press are updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cf74f34767
commit
b1ca8b8ca1
15 files changed
+476
-128
No files matched your search
@@ -3,10 +3,15 @@ declare const com: any;
|
||||
/**
|
||||
* Head-up (look-up wake) trigger on the active glasses session
|
||||
* (GlassesSessionCore.setHeadUpTrigger / getHeadUpStatus). Android only for
|
||||
* now: on iOS, or with no session, the setter does nothing and the getter
|
||||
* returns null.
|
||||
* now (headUpControlsAvailable): on iOS, or with no session, the setter does
|
||||
* nothing and the getter returns null.
|
||||
*/
|
||||
|
||||
/** Whether this platform can change the glasses' head-up setting at all. */
|
||||
export function headUpControlsAvailable(): boolean {
|
||||
return Boolean(global.isAndroid);
|
||||
}
|
||||
|
||||
/** GlassesSessionCore.getHeadUpStatus. switch -1 = not read on this connection. */
|
||||
export type HeadUpStatus = {
|
||||
switch: number;
|
||||
@@ -15,6 +20,11 @@ export type HeadUpStatus = {
|
||||
/** The trigger Faceclaw is maintaining, or -1 when it leaves the glasses' own setting. */
|
||||
desired: number;
|
||||
readAgeMs: number;
|
||||
/** The glasses' own switch and angle from before Faceclaw changed them (switch -1 = none held). */
|
||||
originalSwitch: number;
|
||||
originalAngle: number;
|
||||
/** Those originals are being written back. */
|
||||
restorePending: boolean;
|
||||
};
|
||||
|
||||
function activeCommunicator(): any {
|
||||
@@ -26,12 +36,16 @@ function activeCommunicator(): any {
|
||||
}
|
||||
}
|
||||
|
||||
/** Ask the session to keep the head-up trigger at `degrees` (1..90); 0 stops managing it. */
|
||||
export function setHeadUpTrigger(degrees: number): boolean {
|
||||
/**
|
||||
* Ask the session to keep the head-up trigger at `degrees` (1..90); 0 stops
|
||||
* managing it and writes back `original` (or what the session saved itself)
|
||||
* if Faceclaw changed the glasses' values.
|
||||
*/
|
||||
export function setHeadUpTrigger(degrees: number, original: { switch: number; angle: number } | null = null): boolean {
|
||||
const active = activeCommunicator();
|
||||
if (!active) return false;
|
||||
try {
|
||||
active.setHeadUpTrigger(Math.round(degrees));
|
||||
active.setHeadUpTrigger(Math.round(degrees), original ? original.switch : -1, original ? Math.round(original.angle) : 0);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.warn(`setHeadUpTrigger failed: ${error}`);
|
||||
|
||||
Reference in new issue
Block a user