Simplify glanceboard-trigger angle setting; fix incorrectly-rotated accelerometer readings on G1

The glanceboard head-tilt option was more complicated than necessary,
because it wanted the user to take two angle measurements, a baseline
angle and a tilt angle. That was a workaround to not knowing the
accelerometer's orientation/calibration, but actually, we do know those.

(Except, as it turns out, on the G1, the accelerometer orientation is
different than it is on the G2, and there was a bug where EvenHub apps
got their accelerometer readings in the wrong orientation. So for
example the EvenHub Level app didn't work correctly.)
This commit is contained in:
James Babcock committed 2026-11-15 23:29:02 -08:00
1 parent 37d81d0308
commit e09f8eae96
17 files changed
+255 -281

No files matched your search

+5 -3
View File
@@ -1,7 +1,7 @@
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
import { GrayImage } from "../../graphics/image";
import { clamp } from "../../util/numeric-util";
import { addImuListener, imuSourceLabel, setImuReportEnabled, type ImuReading } from "../../native/imu";
import { addImuListener, imuPitchDegrees, imuSourceLabel, setImuReportEnabled, type ImuReading } from "../../native/imu";
import { type InputEvent } from "../../ui/gestures";
import { Layer, type LayerContext } from "../../ui/layers";
import { shell } from "../../ui/shell/shell";
@@ -23,7 +23,8 @@ const BAR_RIGHT_INSET = 4;
/**
* Accelerometer demo: turns the IMU stream on while this page is visible (the
* Developer window is foregrounded and the screen is on), off otherwise, and
* shows the latest x/y/z reading with a simple per-axis bar.
* shows the latest x/y/z reading (Faceclaw's frame, imu-types.ts) with a
* simple per-axis bar, and the head's pitch.
*
* The IMU stream is experimental — the firmware may never populate it — so the
* page also reports how many samples have arrived.
@@ -92,7 +93,8 @@ export class AccelerometerDemoLayer implements Layer {
const bodyX = padding.left + BODY_INDENT;
image.drawText(small, padding.left, top, "Accelerometer", 220);
const status = this.enabled ? "IMU on" : "IMU off";
const pitch = this.reading ? `pitch ${Math.round(imuPitchDegrees(this.reading))}° ` : "";
const status = pitch + (this.enabled ? "IMU on" : "IMU off");
image.drawText(small, right - small.measureText(status), top, status, 150);
if (this.reading) {