Commit Graph
592 Commits
Author SHA1 Message Date
James Babcock 90d60cee10 Dither when darkening for the system context menu 2026-09-25 01:30:26 -07:00
James Babcock 4f3ad37c20 Custom auto-brightness, and fade in/out effects 2026-09-25 00:57:43 -07:00
James Babcock f66e0b025f Add partial rows and a bounce effect to menus 2026-09-24 12:23:20 -07:00
James Babcock c801bd5185 Animate scrolling in menus 2026-09-24 11:04:10 -07:00
James Babcock 915f155819 Add Glanceboard depth setting 2026-09-24 02:26:20 -07:00
James Babcock 71c1971992 Use animated menus in a bunch more places 2026-09-23 23:57:50 -07:00
James Babcock 123c1142d6 Better menu class; use it in the Music app 2026-09-23 22:05:44 -07:00
James Babcock 440674b261 Animations are mainly on the typescript side, not kotlin 2026-09-23 22:05:06 -07:00
James Babcock 063d8a0b03 Clean up magic-numbers used in menu animation 2026-09-23 11:34:20 -07:00
JMO 67c0671b99 Log what the lens answers the prompt page with
An ack is not a render: the lens can accept the create-prompt page and display
nothing, so a null check on the reply throws away the only thing that can say
what it did. The page size going out and the ack payload coming back are both
logged now.
2026-09-23 08:46:56 -07:00
JMO 423f9fbcd1 Refuse the flash with a reason when the glasses are in silent mode
Silent mode blanks the display and stops the firmware dispatching input while
BLE and GATT stay up, so the create-prompt page is written, accepted, and never
rendered. There is no touchpad event available to answer it with, and the flash
ends after four attempts on "prompt page not acked", which tells the wearer
nothing about what is wrong or what to do about it.

readBattery was already performing a sid-0x09 settings read whose ack carries
silentMode next to the battery, and the field was being discarded. readSettings
is factored out so one read serves both callers, and requireNotSilent runs it
before the prompt page is written. A positive report throws, and the existing
error path turns the message into what the wearer sees: that the glasses are in
silent mode, and that long-pressing both touchpads leaves it.

It refuses only on a positive report. An arm that does not answer, and firmware
whose ack omits the field, both fall through to the prompt exactly as before, so
older firmware is unaffected and a missing answer can never block a flash.

This replaces the phone-side confirmation fallback that was here before. An
unacked page is not by itself evidence that the prompt was never displayed, and
the on-lens step is what proves the glasses being flashed are the ones in front
of you, so overriding it on a timeout gave up more than it was worth.
2026-09-23 08:12:19 -07:00
James Babcock 08f1b9a2a2 Optimize on-glasses animation 2026-09-23 02:58:29 -07:00
James Babcock c8d835176f Display-list based menu slide animation 2026-09-23 01:13:03 -07:00
JMO b361cdd934 Say how to leave silent mode, and drop the belief when it is contradicted
Silent mode is entered and exited only by long-pressing both touchpads. While
it is on the firmware ignores all input and blanks the display, so from the
phone the glasses look connected and simply answer nothing. The app cannot turn
it off either: the communicator exposes onSilentMode and a listener set, and no
setter.

The status read "Connected (Silent mode enabled)", which names the state but
not the way out of it, and someone who triggered the gesture by accident has no
reason to know the gesture exists. It now names it.

The belief can also go stale. silentMode is set by the firmware's push event
and cleared only when the phase goes to disconnected, on the assumption that it
is re-reported on the way back up. Toggle silent mode on the glasses without
the link ever dropping and that assumption does not hold: a missed "off" leaves
the phone claiming silent mode for as long as the connection lasts. Observed
with the status reading silent while the glasses were granting framebuffer
leases and rendering frames, which cannot happen in a mode whose whole
behaviour is to blank the display and ignore input.

So the belief is dropped whenever the glasses do something that mode makes
impossible: input from them, since the firmware discards input while silent, or
a shell render that gets past the display-target check, since silent mode does
not leave a display target standing. The second matters because it self-heals
without the user touching anything.

Not unit-tested. Both halves are in dashboard-controller.ts, which imports 56
modules, so a test there would mostly exercise mocks, and the stale-clear is
state management across events rather than a pure function. The refactor that
would make it testable is moving the silent-mode belief into a small state
holder taking the firmware's push events plus the two kinds of contradicting
evidence; glasses-display-state.ts next door is already exactly that shape.
2026-09-22 22:09:40 -07:00
JMO df77b672f5 Stop the shell render loop spinning when there is no display target
renderShell paints first and checks for a display target last, and the
stale-data repaint re-requests before that check. requestShellRender runs
`do { renderShell() } while (shellRenderQueued)`, and because a render is
already in progress the re-request just sets shellRenderQueued. So with no
display target the two feed each other: paint, report stale, re-queue, discard
the work, round again, with no yield and no backoff. SHELL_REFRESH_INTERVAL_MS
is 60 seconds, so the timer is not the driver.

Measured on a device with the glasses not presenting, from the app's own
frame-timings export: 40 of 40 recorded frames were render:shell
target=shell-overlay, every one discarded, mean 55 ms and median 53 ms apart,
so about 19 full renders a second all thrown away. Main thread state=Runnable
with utm=22599, and seven ANR records over three days, each "Input dispatching
timed out ... Waited 10001ms". Afterwards the same state produced 5 renders in
100 seconds, and the export showed a normal mixed workload again instead of
one loop crowding everything else out.

Hoisting the check above the paint fixes both halves at once: a frame with
nowhere to go costs nothing, and the stale-data re-request lives downstream of
the early return, so it can no longer feed the loop. The copy of the check that
used to sit after the paint is removed rather than left in place. Nothing
between the two points can change the result, and the compiler agrees: the
early return narrows this.phase, which made the "charging" comparison
unreachable (TS2367).

submitWindowFrame, the sibling path for in-process window frames, already
checks the display target before doing any work.

Not unit-tested. The change is in dashboard-controller.ts, which imports 56
modules, so a test there would mostly exercise mocks, and it is an ordering
defect rather than a predicate, so extracting a shouldPresent() helper would
pass both before and after. The shape that would work is pulling the render
gate and its stale-data retry into a small module taking the display target and
the stale flag and returning whether to paint and whether to re-request.
2026-09-22 22:09:35 -07:00
JMO a7916a5479 Make the firmware upgrade reachable from older custom firmware
Glasses running an older Faceclaw firmware revision cannot be upgraded at all.
The flash asks for confirmation on the lens first, and that firmware never
shows the prompt, so the one path off it is closed. Measured on revision 13
(base 2.2.9.22).

showPrompt writes the EvenHub create-prompt page to the right arm and waits for
an ack. The lens accepts the write at the GATT layer and then answers nothing
and displays nothing: four attempts, four onWriteCharacteristic status=0
length=165, no reply. buildCreatePromptPage documents its geometry as
stock-firmware-safe "so this works before flashing", and that does not hold
there.

Three faults, each only visible once the previous one is fixed.

An unacked prompt page was fatal. Flashing is the only way off that firmware,
so failing here leaves the glasses permanently unupgradable. An unacked page
now falls back to the phone-side confirmation that the low-battery retry
already uses, on a screen that says what is being given up: the on-lens step is
what proves the glasses are the wearer's.

connectArm made a single attempt. The lens is routinely unavailable for a
moment just after a previous link to it closed, which is exactly the state a
retry is in, so the fallback failed instantly with "could not connect to the
right arm". FaceclawFirmwareFlasher.connectLensResilient already retries within
a window for this reason; connectArmResilient mirrors it and reports each
attempt.

That retry then tripped the lost-connection latch. Disconnecting between
attempts fires onConnectionStateChange, which set rightLost AND finished and
counted down the selection latch, so a successful second attempt still aborted
with "Lost connection to the glasses". The callback now ignores drops while the
arms are still being established.

Logging, because a failed flash used to leave almost nothing to read. emitLog
reached logcat, but emitState, emitProgress and emitComplete on the flasher,
and emitState and emitResult on the prompt communicator, went only to the
in-app listener, so the line carrying the reason existed only on the phone
screen. Seven `catch (Exception ignored)` blocks across the two classes now log
with the Throwable, matching the call sites elsewhere that already do.

tests/flash-prompt-fallback.test.cjs covers the decision at its seam through
the existing load-typescript loader. The first test fails against the current
view model and passes with this change; the second is a regression guard and
passes either way, so an unrelated failure cannot quietly skip the on-lens
confirmation.

Verified on hardware: both lenses flashed through this path after it had been a
dead end.
2026-09-22 22:09:11 -07:00
James Babcock 92e8def0f0 Merge branch 'main' of https://github.com/jimrandomh/faceclaw 2026-09-22 21:40:55 -07:00
James Babcock be20b24985 Merge pull request #34 from jmomakesstuff/fix/evenhub-signin-form
Fix the EvenHub sign-in form reopening every launch and never closing
2026-09-22 21:40:49 -07:00
James Babcock 4a194e37bb Refactor iOS version to use a bunch more shared code 2026-09-22 21:26:51 -07:00
James Babcock c3a0ba9f56 Refactor Kotlin for iOS commonality 2026-09-22 19:55:08 -07:00
JMO 662cbd75dc Fix the EvenHub sign-in form reopening every launch and never closing
Open EvenHub once without finishing sign in and the phone side form comes back
on every app start, with no way to close it. Back exits the app rather than
closing the form.

Three things combine:

- EvenHubStoreLayer.paint() opened the credential editor on its first paint
  when no credentials were stored. First paint includes the restore of a
  still-open EvenHub at startup, so an unfinished sign in put the form back
  every time. handleInput already opens it on a click, so the auto open only
  removed the choice of when.

- LayerActions.startTextSettingsEdit declares a fifth onCancel parameter, but
  the DashboardController wiring forwarded four and the method accepted four.
  Nothing failed to compile, because a 4-parameter function is assignable to a
  5-parameter function type. That callback resets openCredentialEditor's
  phoneEditor guard, so with it dropped the guard latched at "credentials":
  the screen timeout hid the panel without resetting the state behind it, and
  the form could then be neither closed nor reopened. ios-preview-controller.ts
  already forwards all five, so this was the G2 path only.

- The panel has no Cancel control, so the keyboard's Done key on the password
  field is the only way to end the edit. On an untouched form that reached
  submitCredentials, which called enterLogin("Email and password are
  required."), which reopens the editor. A loop with no exit.

The auto open is removed; onCancel is forwarded, stored and fired from
endTextSettingEdit, with finishTextSettingEdit clearing it first so a completed
edit does not also report a cancel; and a wholly empty submission is treated as
a cancel. A half-filled form is a real mistake and still reopens with the
message.

tests/evenhub-signin.test.cjs covers the open and close contract through the
existing load-typescript.cjs loader. Two of its five tests fail against the
current store-layer.ts and pass with this change.
2026-09-22 19:07:22 -07:00
James Babcock 587364e5e6 Convert most Android-specific kotlin to shared or shareable 2026-09-22 18:43:55 -07:00
James Babcock f9724ddcab Convert remaining Java to Kotlin 2026-09-22 17:26:09 -07:00
JMO c2dbd33e6d Add a secret-scanning workflow
Runs gitleaks on pushes to main and on pull requests. The settings file
pull_config.sh produces holds API keys in plain text, and .gitignore covers the
default filename, but nothing catches a rename or a key in a test fixture.

.gitleaks.toml allowlists one path: the constant in app/apps/evenhub/even-api.ts
that matches the generic-api-key rule. Scoped by path rather than disabling the
rule, so everything else is still scanned.
2026-09-22 16:28:16 -07:00
James Babcock ea9bfae6af Refactor: g2flash protocol doesn't have so many magic numbers 2026-09-22 16:27:04 -07:00
James Babcock 306accf06d Move Nightscout "Always show in top bar" setting earlier in the form so it's harder to miss 2026-09-22 15:15:31 -07:00
James Babcock 2e4d20e130 Clean up unused worker threads for closed apps; other performance optimizations 2026-09-22 14:56:54 -07:00
James Babcock 9560f3ac8d Phone CPU usage optimization 2026-09-22 14:19:23 -07:00
James Babcock 44eddedc01 Add script for collecting CPU profile information 2026-09-22 11:54:45 -07:00
James Babcock 392554dd37 Depth effects 2026-09-22 10:59:51 -07:00
James Babcock 4320021222 Display lists 2026-09-22 00:25:40 -07:00
James Babcock a7af84e231 Nightscout glanceboard widget shows out-of-bounds values when out of space 2026-09-21 18:08:29 -07:00
James Babcock 26b7da9797 Merge branch 'main' into cache-management 2026-09-20 18:36:36 -07:00
James Babcock 313ccd86d9 Ungate some settings on iOS 2026-09-20 18:33:24 -07:00
James Babcock db5f725f38 Add to changelog 2026-09-20 18:24:18 -07:00
James Babcock 325346b824 Merge branch 'add-tests-workflow' 2026-09-20 18:24:07 -07:00
James Babcock 0c3d7517bc Resource management for the texture cache 2026-09-20 18:23:33 -07:00
James Babcock 146fe66bdd Add "map around me" mode to Navigate app 2026-09-20 17:02:24 -07:00
James Babcock 623c4c96f7 Merge pull request #31 from jmomakesstuff/add-tests-workflow
Add a workflow to run the tests
2026-09-20 15:29:43 -07:00
James Babcock 286a3819bf Merge branch 'add-tests-workflow' of https://github.com/jmomakesstuff/faceclaw into add-tests-workflow 2026-09-20 15:27:03 -07:00
James Babcock 183adf5a43 Remove some failing tests that were accidentally retained form experiments or other branches 2026-09-20 15:22:17 -07:00
James Babcock 07828db0bf Refactor texture cache usage to shared Kotlin for iOS 2026-09-20 15:12:13 -07:00
JMO 32134e731c Add a workflow to run the tests 2026-09-20 09:21:13 -07:00
James Babcock ccb320c66f Add tokens and faceclaw-input script, which allows using a CLI utility as an input device for the glasses 2026-09-20 00:34:58 -07:00
James Babcock 313ba85708 Hub apps on iOS no longer have their timers stopped while the phone app is in the background 2026-09-19 22:07:35 -07:00
James Babcock 6c3144cc31 Make iOS app main screen match the Android UI 2026-09-19 21:54:18 -07:00
James Babcock 9f53847bb7 Merge branch 'main' of https://github.com/jimrandomh/faceclaw 2026-09-19 21:04:08 -07:00
James Babcock 6fe766a4e0 Unify settings format 2026-09-19 21:03:44 -07:00
James Babcock 3f6e5e2cba Tweak iOS calendar permission-request text 2026-09-19 20:59:59 -07:00
James Babcock 32063e57cd iOS calendar integration 2026-09-19 20:52:36 -07:00