G1: Microphone, light sensor, accelerometer, bandwidth benchmark, wear detection

This commit is contained in:
James Babcock committed 2026-11-06 01:44:37 -08:00
1 parent 67aff19923
commit 345ba36c33
11 files changed
+635 -32

No files matched your search

+13 -4
View File
@@ -10,6 +10,7 @@ import {
type CompassDiagnostics,
} from "../../native/compass";
import { wrapText } from "../../graphics/textwrap";
import { glassesTypeSetting } from "../../ui/dashboard-settings";
import { type InputEvent } from "../../ui/gestures";
import { type Layer, type LayerContext } from "../../ui/layers";
import { lineStep } from "../../ui/metrics";
@@ -151,6 +152,7 @@ class CompassLayer implements Layer {
}
private statusText(): string {
if (noCompassSensor()) return "These glasses have no compass sensor";
if (this.firmwareStatus !== null) return this.firmwareStatus;
if (!this.enabled) return "Compass paused";
if (this.rawHeading === null) return "Waiting for compass data…";
@@ -206,8 +208,10 @@ class CompassLayer implements Layer {
image.drawText(small, Math.round(cx - small.measureText(line) / 2), y, line, 125);
y += smallStep;
}
const accuracyText = magneticAccuracyText(this.diagnostics);
image.drawText(small, width - ACCURACY_RIGHT_PAD - small.measureText(accuracyText), ACCURACY_TOP_PAD, accuracyText, 175);
if (!noCompassSensor()) {
const accuracyText = magneticAccuracyText(this.diagnostics);
image.drawText(small, width - ACCURACY_RIGHT_PAD - small.measureText(accuracyText), ACCURACY_TOP_PAD, accuracyText, 175);
}
return image;
}
@@ -216,10 +220,15 @@ class CompassLayer implements Layer {
// "Uncalibrated" prompt advertises, and re-calibrating is a normal thing to
// want once the glasses have been taken off and put back on.
handleInput(event: InputEvent, ctx: LayerContext): void {
if (event.type === "click") this.openCalibration(ctx);
if (event.type === "click" && !noCompassSensor()) this.openCalibration(ctx);
}
}
/** A G1 has an accelerometer and a gyroscope, but no magnetometer. */
function noCompassSensor(): boolean {
return glassesTypeSetting.get() === "g1";
}
export function createCompassAppWindow(options: InProcessAppOptions): InProcessWindow {
let requestRender = () => {};
const layer = new CompassLayer(() => requestRender());
@@ -231,7 +240,7 @@ export function createCompassAppWindow(options: InProcessAppOptions): InProcessW
icon: "compass",
closeable: true,
actions: options.actions,
menuItems: () => [
menuItems: () => noCompassSensor() ? [] : [
{
label: "Calibrate",
onSelect: (ctx) => {