Skip to content

feat(app,firmware): configurable single, double and triple tap - #13185

Open
singhharsh1708 wants to merge 22 commits into
BasedHardware:mainfrom
singhharsh1708:feat/app-single-tap-action
Open

singhharsh1708 wants to merge 22 commits into
BasedHardware:mainfrom
singhharsh1708:feat/app-single-tap-action

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2825

Single, double and triple tap are configurable on the device page. Long press stays the fixed 3 second power off.

Firmware (CV1, omi/firmware/omi). The existing button characteristic (23ba7925) is untouched, so shipped apps and onboarding see what they see today. A second notify characteristic on the button service (23ba7926) sends [1, n] when tap n is released and [2, n] once 350 ms pass without another press, or as soon as a press turns into a hold. Feature bit 9 advertises it. The recogniser is tap_sequence.h, a Zephyr-free header with a host test registered in the checks manifest.

App. With bit 9 the app reads tap counts from the new characteristic and ButtonTapDispatcher decides when to act: tap n's action runs on the tap itself when no higher count is mapped, otherwise at the end of the sequence. With the defaults a double tap waits for the window; setting triple tap to Off makes it instant, and turning both off makes single tap instant. Older firmware keeps the legacy stream, where single and double tap can be remapped too. Triple tap has an Off option, and double tap gets one on firmware with bit 9. The triple tap row and the fixed Turn Off row only show on firmware with bit 9. The rows sit inside the Omi button actions switch and the tap path honours it.

Ported to current main. Main rebuilt the device page and pulled the button handler out of its closure, so both halves moved:

  • The rows are OmiSettingsRows in _customizationGroup, and the three pickers share one sheet in device_control_sheets.dart.
  • _handleButtonEvent routes single and double tap through _runButtonAction and steps aside for a device that reports tap counts. The ask-a-question toggle is main's code moved into _toggleVoiceQuestion, so the tap path shares the auto-submit grace and the drop telemetry.
  • Main fixed the trailing release ending a question on its own, so that fix and its tests are no longer part of this PR.
  • ScriptedDeviceConnection answers the feature query and can emit tap counts, since the tap path asks every connection for its features.
  • The two new preferences live in button_action.dart, because main keeps preferences.dart at 1500 lines.
  • tripleTap and tripleTapAction have descriptions in app_en.arb (the nit from the last review).

New tests on the legacy stream: a remapped single tap runs its action instead of starting a question, a double tap set to Off does nothing, a device that reports tap counts is handled once by the tap stream, and firmware without tap counts keeps the legacy stream. The first and third fail with the remap or the hand-off removed.

Verified from app/:

$ flutter test test/providers/capture_provider_test.dart test/providers/omi_button_actions_controller_test.dart test/unit/button_action_test.dart test/widgets/device_settings_double_tap_test.dart
00:10 +146: All tests passed!

$ flutter test --dart-define=OMI_DEV_CONTROLS=1 test/spine
01:03 +138: All tests passed!

$ bash scripts/analyze_ratchet.sh
Analyzer ratchet passed.

$ python3 scripts/l10n.py check
ok: 49 locales, 3828 keys

$ scripts/pr-preflight --pr-body-file <this description>          (repo root)
PR preflight passed: 24 checks in 341.30s.

What I could not check: I don't have an Omi, so the button behaviour needs a hardware pass with Thinh before this merges. The firmware files are the ones built earlier with the release workflow's Docker image; I have not rebuilt them on this merge, and this machine has no C compiler for the host test, which CI runs.

Product invariants affected

  • INV-CAP-1

The tap listener is a second notify on the button service, subscribed next to the existing button listener. The audio subscription, the uplink policy and the sync fence are not changed, and the two guard tests (tiered_capture_test.dart, resume_sync_fence_test.dart) pass.

Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 4230 -> 4323 | the tap dispatch sits next to the button handling this file already owns
UI-Evidence: none -- renders of the rows and the sheets are in a comment below, there is no device here to capture on
Failure-Class: none

Single and double tap now resolve through a shared ButtonAction instead
of the double tap branch owning its own effect handling. Single tap
defaults to asking a question, which is the existing behaviour, and the
stored double tap encoding is unchanged.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 104 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/lib/l10n/app_localizations_he.dart Resolved
…p maps to

Interactive onboarding step one lets a single tap through to record the
ask a question demo. Resolving the stored mapping there hijacked that
tap, so the step could not be completed with a non default mapping.
@singhharsh1708

Copy link
Copy Markdown
Contributor Author

Fixed in 125ac99. Onboarding step one now forces the question action whatever single tap maps to, with two tests covering it. Hebrew singleTap is now לחץ בודד to match the לחץ כפול next to it.

@singhharsh1708

Copy link
Copy Markdown
Contributor Author

Screens for this one. Same caveat as the other, rendered from the widgets in a golden test rather than filmed off a device.

Single Tap sits above the existing Double Tap row and defaults to Ask Omi a Question:

settings row

The picker:

picker

@singhharsh1708

Copy link
Copy Markdown
Contributor Author

I don't have an Omi here, so the one thing I couldn't exercise is a remapped single tap on the actual button. You mentioned on #2825 you'd help test with a device. Still up for that?

@Git-on-my-level

Copy link
Copy Markdown
Member

Solid, well-scoped contribution - the consolidation direction is right and the description is refreshingly explicit about what was and wasn't verified.

What I checked against the head:

  • app/lib/services/capture/button_action.dart: ButtonAction + the three resolvers is a clean consolidation. resolveDoubleTapAction preserves the legacy stored encoding exactly (1 -> toggleMute, 2 -> starConversation, default -> endConversation), so existing doubleTapAction prefs ride through untouched. The asymmetric code spaces (single: 1/2/3 = end/mute/star vs double: 1/2 = mute/star) are a little surprising for future readers, but the tests pin them explicitly, which is the right safeguard.
  • app/lib/services/capture/capture_controller.dart: _runButtonAction reproduces the old inline double-tap branch faithfully - same ordering of analytics before pause/resume, same _isProcessingButtonEvent set/clear around the async mute path, same star/unstar haptics. The onboarding gate (resolveSingleTapActionForSession forcing askQuestion while deviceOnboardingProvider.currentStep == 1) is correct: that step is the single-press ask-question demo and a remap would otherwise hijack it. Good proactive fix.
  • app/lib/backend/preferences.dart: singleTapAction key defaulting to 0 (ask question) matches today's behavior, so no preference migration is needed.
  • app/lib/pages/settings/device_settings.dart: the Single Tap row and picker mirror the existing Double Tap UI (same endAndProcess / deviceOnboardingMuteUnmute / starOngoing labels in the sheet), so the settings surface stays consistent.
  • app/test/unit/button_action_test.dart: good coverage of the mapping, unknown-code fallbacks, preference round-trip, and both onboarding-gate cases. The l10n sweep (app_en.arb + all app_.arb and generated app_localizations_.dart) is complete for both new keys.

The firmware claim checks out: omi/firmware/omi/src/lib/core/button.c notifies SINGLE_TAP 1 / DOUBLE_TAP 2 / LONG_TAP 3 with no triple-tap state, so deferring triple press until the firmware can emit it was the right call.

Two things to settle before merge:

  1. Remapped single-tap actions currently emit no analytics (only Omi Double Tap fires, via the trackDoubleTap gate). Keeping the series clean is the right instinct, but the event name is a product decision worth making now rather than post-merge.
  2. The dispatch hasn't been driven by a real button - the mapping and effects are verified by tests, but someone with an Omi should confirm a remapped single tap (end / mute / star) end to end, including the onboarding step-1 fallthrough.

Leaving merge sign-off to maintainers for those two items. Thanks for the clean work and the honest testing notes.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs a human maintainer to sign off before merge positive-signal Automation verified a genuine fix/quality contribution flutter flutter work labels Sep 9, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile feature (configurable single-tap action), defaults preserve existing behavior, large diff mostly l10n .arb files. Feature -> approve only per policy.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified on head 125ac99 — thank you for the careful write-up and the follow-up commits; the earlier review notes are addressed on this head.

What I checked:

  • app/lib/services/capture/button_action.dart — clean mapping layer. resolveSingleTapAction defaults 0/unknown to askQuestion, so the new preference is strictly opt-in, and resolveDoubleTapAction preserves the legacy stored encoding (1 mute, 2 star, else end) exactly, so no existing preference changes meaning.
  • app/lib/services/capture/capture_controller.dart — _runButtonAction consolidates the three former double-tap branches (mute/unmute with the _isProcessingButtonEvent guard and async reset, star/unstar with haptics, end+process) verbatim, and the double-tap path dispatches through it with trackDoubleTap: true, so the omiDoubleTap series stays intact. Single tap resolves through resolveSingleTapActionForSession, which forces askQuestion while onboarding step 1 is active — combined with the existing interception fall-through, the onboarding ask-question demo keeps working even with a remapped single tap. Remapped single taps also check the processing guard before dispatch, matching double-tap behavior.
  • app/lib/backend/preferences.dart — new singleTapAction key following the same pattern as doubleTapAction; no migration needed.
  • app/lib/pages/settings/device_settings.dart — the Single Tap row and bottom sheet mirror the Double Tap UI (single_tap_row key, chip label, checkmark on the current value); option codes 0–3 match the resolver, and the chip/sheet label pairing follows the existing double-tap convention.
  • app/test/unit/button_action_test.dart — good focused coverage: default, each code, unknown/negative fallback, preference round-trip, and the onboarding override.
  • l10n — 102 of the 104 files are mechanical propagation of the two new strings; spot-checked translations look right, and tl carrying English mirrors its existing doubleTap entry.

Two things a maintainer may still want to rule on before merge, both already surfaced in the discussion: real-device verification of a remapped single tap, and whether single tap should get its own analytics event name — sending nothing rather than polluting the omiDoubleTap series was the right default.

@kodjima33 has approved this head, so I'm dropping the needs-maintainer-review label; positive-signal and flutter stay.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

The legacy button characteristic is left exactly as it is. A second
notify characteristic on the button service sends [1, n] when tap n is
released and [2, n] once 350 ms pass without another press (or a press
turns into a hold), and feature bit 9 advertises it. The recogniser is a
Zephyr-free header on k_uptime_get_32, so the legacy FSM's tick resets
cannot skew it, and a host test covers single, double, triple, a hold
after a tap, a lone hold and uptime wraparound.
…is mapped

When the firmware advertises the tap sequence characteristic, the app
reads tap counts from it and ButtonTapDispatcher runs tap n straight
away if nothing is mapped to a higher count, otherwise it waits for the
sequence end. Double and triple tap can now be turned off, triple tap
defaults to ending the conversation, and Device Settings shows the
triple tap row and the fixed hold-to-power-off row only on firmware that
supports it. Older firmware keeps the legacy single and double tap path,
and onboarding still reads the legacy stream.
Whitespace-only move so the handler can be driven from a test; git diff -w shows just the new method signature and the call.
…the button

On CV1 firmware a single tap arrives as 1 followed by a trailing 5, so
the legacy handler started the question on 1 and ended it straight away
on the 5 meant for hold-to-talk. The release now only ends a session
that a long press (3) started.
@singhharsh1708 singhharsh1708 changed the title feat(app): make the single tap button action configurable feat(app,firmware): configurable single, double and triple tap Sep 14, 2026
@singhharsh1708

Copy link
Copy Markdown
Contributor Author

Updated this to cover the whole #2825 checklist, triple tap included, firmware and app. It only waits out the triple tap window when a longer tap is actually mapped, so double tap stays instant for anyone who turns triple tap off, and the existing button characteristic is unchanged for shipped apps. What still needs a real build and a hardware pass is at the bottom of the description.

src/lib/core has its own features.h, and with -I glibc's stdint.h picked it up instead of the system one, so the host test failed to compile on Linux. -iquote only affects quoted includes.
@Git-on-my-level

Copy link
Copy Markdown
Member

Follow-up on the current head (2dcce3d), which adds the firmware side and triple tap to the earlier app-only change. The previous verification covered the app mapping layer on 125ac99; what is new here is a second BLE characteristic, a firmware recogniser, and the triple-tap wiring, so this pass focused on that.

What I verified on this head:

  • omi/firmware/omi/src/lib/core/tap_sequence.h — clean Zephyr-free recogniser on uptime wall-clock (the right call given the legacy FSM resets its tick counter on every release). I ran the new host test (omi/firmware/omi/tests/tap_sequence/run.sh) locally: all 7 cases pass, including uptime wraparound and the hold-after-tap early end.
  • omi/firmware/omi/src/lib/core/button.c — the legacy characteristic and FSM are untouched; the taps characteristic (23ba7926) is notified via &button_service.attrs[4], the same declaration-attribute convention the existing attrs[1] notify uses, and the shared CCC handler is log-only, so the two subscriptions do not interfere. The 40 ms work-handler cadence gives the 300/350 ms thresholds at most one poll of jitter, same as the existing thresholds.
  • omi/firmware/omi/src/lib/core/transport.c + features.h — bit 9 is advertised only under CONFIG_OMI_ENABLE_BUTTON, so existing images report nothing new and older apps ignore the bit.
  • app/lib/services/capture/button_action.dart — ButtonTapDispatcher gets the wait-vs-fire-now logic right: with defaults (single ask, double and triple end) single and double wait for the sequence end and triple fires on the third tap; turning off the longer taps makes the shorter ones instant. Edge cases are tested (extra taps after firing, a missing sequence end, counts past 3).
  • app/lib/services/capture/capture_controller.dart — the legacy path is suppressed only when the taps subscription is actually live (_buttonTapsActive), so older firmware keeps today's behaviour exactly; onboarding still consumes the legacy stream and step 1 keeps forcing ask-a-question. The _voiceSessionFromHold fix means a remapped single tap no longer ends a question session started by holding — good catch, with tests.
  • app/lib/pages/settings/device_settings.dart — the triple-tap row and the fixed power-off row are gated on bit 9; triple reuses the double-tap encoding, and existing doubleTapAction preferences keep their meaning.

Two things to confirm during the hardware pass:

  1. On firmware with bit 9, the gap that still counts as a double/triple tap is 350 ms (TAP_SEQUENCE_GAP_MS) where the legacy FSM allowed 600 ms (DOUBLE_TAP_WINDOW). A slower tap rhythm now lands on the single-tap action instead. Worth checking on-device, or aligning with 600 ms if it feels too tight.
  2. With defaults, a double tap waits out the full window even though triple maps to the same end-conversation action — per the stated design, just confirm the delay feels acceptable in hand.

Checks are green on this head, including the Dart suite and generated-files. The new GATT characteristic and feature bit are a device-protocol addition and the approval on record predates the firmware expansion, so an on-device pass (the author is ready to coordinate testing) should be the final gate before merge.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added the needs-maintainer-review Needs a human maintainer to sign off before merge label Sep 15, 2026
…ction

# Conflicts:
#	.github/checks-manifest.yaml
…ction

# Conflicts:
#	app/lib/services/capture/capture_controller.dart
@singhharsh1708

Copy link
Copy Markdown
Contributor Author

@kodjima33 this has moved on since your approval: it now covers the whole #2825 checklist (triple tap in firmware, remappable taps, and the trailing release fix), it is up to date with main including the CaptureLifetime changes, and the firmware builds with the release workflow's Docker build. CI is green. Would you mind taking another look?

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feat(app): configurable tap actions — reclassified to mobile/app (no firmware source files present in current diff despite label); feature, approve-only. CI green.

…ction

# Conflicts:
#	app/lib/services/capture/capture_controller.dart
@singhharsh1708

Copy link
Copy Markdown
Contributor Author

Merged main in. Only conflict was the button closure this PR pulls out into _onLegacyButton, and main had changed _isPaused to the isPaused getter inside it, so that carried over. Full suite, ratchet and preflight rerun on the merge, and the line count exception is updated to main's new size.

streamButton detaches the taps listener and re-attaches it several BLE round trips later, and it runs on every connect and every unmute. In that window the legacy stream handled the gesture, then the sequence end arrived and the dispatcher, which had no idea it had missed the taps, ran the action a second time. A double tap mapped to starring ended up unstarring. Suppression now follows the device's capability rather than the listener's attachment state, and the dispatcher ignores an end it never saw taps for, which also covers the taps dropped while onboarding is active.
The Off row was rendered only when the device had reported bit 9, but the chip reads Off from the stored value regardless. A user who set Off and then opened Device Settings while disconnected saw four options with none selected and no way back to Off.
@singhharsh1708

Copy link
Copy Markdown
Contributor Author

Pushed f210017 and e7b72f0.

The dispatch path had a race that could run the opposite of the mapped action. streamButton detaches the taps listener and re-attaches it several BLE round trips later, and it runs on every connect and every unmute. _buttonTapsActive was false for that whole window, so the legacy stream handled the gesture, then the firmware's sequence end arrived and the dispatcher, with no way to know it had missed the taps, ran the action again. With double tap mapped to starring the second run took the toggle's other branch and left the conversation unstarred, and an Omi Double Tap unstar event went with it. Suppression now follows the device's capability rather than the listener's attachment state, and the dispatcher ignores a sequence end it never saw taps for, which also covers taps dropped while onboarding is active.

Two other things worth flagging. The wraparound case in the firmware host test was not testing what it printed: hold() computed now_ms + duration_ms, so past the overflow the loop ran a single poll and the 120/160/120 ms double tap it describes was really a 40 ms press. It measures elapsed time with an unsigned difference now, and still passes, so the recogniser was right across the boundary. And the description said two new strings when the diff adds four: singleTap, singleTapAction, tripleTap and tripleTapAction. Corrected above.

Also fixed: Off stayed in the stored value but the row was only rendered on firmware that had reported bit 9, so opening Device Settings while disconnected showed four options with none selected and no way back to Off.

Four tests, each checked against the previous head. Suite 2426 passed, ratchet passed, preflight 21 checks. Firmware is unchanged since the Docker build quoted above apart from the test harness.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configurable tap-actions feature (confirmed no firmware/ files actually touched despite title - pure app/l10n diff), feature not bug fix - approve-only.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving after new commits (button-actions-switch integration fix + main merge, 2026-09-22). Feature PR (app tap-config), no firmware paths despite title/label (0/100 files under omi/firmware/), predates and is unrelated to the singhharsh1708 self-bounty-issue pattern seen elsewhere in this account's queue (closes old issue #2825, not a same-day self-filed bounty proposal). Approve-only per policy (feature, not bug fix); already approved 3x by kodjima33 across iterations.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (configurable single/double/triple tap) - verified app-side only, approve only per policy; DIRTY.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @singhharsh1708 — this is a well-put-together feature. I reviewed the diff file by file; some observations and one small nit.

Firmware

  • omi/firmware/omi/src/lib/core/tap_sequence.h — clean, Zephyr-free recogniser with explicit TAP_SEQUENCE_MAX_PRESS_MS/TAP_SEQUENCE_GAP_MS constants; the k_uptime_get_32 clock choice to avoid the legacy FSM's resetting tick counter is a nice detail. count saturates at UINT8_MAX instead of wrapping, and hold-presses emit an early END so listeners aren't left waiting the full gap.
  • omi/firmware/omi/src/lib/core/button.c — I checked the one thing that looked risky: notify_tap_sequence notifies on &button_service.attrs[4]. Since BT_GATT_CHARACTERISTIC expands to a declaration+value pair, attrs[4] is the taps characteristic declaration and Zephyr resolves the value handle from the chrc user_data — the same pattern as the working legacy notify at attrs[1], so this is correct. Running the recogniser from check_button_level alongside the legacy FSM, with the legacy characteristic (23ba7925) untouched, keeps shipped apps and onboarding behavior unchanged.
  • omi/firmware/omi/src/lib/core/transport.c + features.h — bit 9 advertised only under CONFIG_OMI_ENABLE_BUTTON, consistent with the other feature bits.
  • omi/firmware/omi/tests/tap_sequence/* + .github/checks-manifest.yaml — good host test (single/double/triple/hold cases) and the manifest entry has narrow triggers; matches the existing pattern.

App

  • app/lib/services/capture/button_action.dart — ButtonTapDispatcher logic is sound: acting on tap n immediately only when no higher count is mapped, otherwise at sequence end, gives the "turn off what you don't use → instant response" property described in the PR. The resolveSingleTapActionForSession onboarding override preserves the ask-a-question step.
  • app/lib/services/capture/capture_controller.dart — the legacy _bleButtonStream path is retained for old firmware and onboarding, the new taps stream is cancelled alongside the others, and prefs default to 0 which maps to the existing ask-a-question / end-conversation behavior — backward compatible.
  • app/lib/pages/settings/device_settings.dart — the Single/Triple rows are gated on the bit-9 feature check and hidden otherwise; the "stored Off stays selectable" widget test covers the stale-preference edge case.
  • app/lib/services/devices/connectors/omi_connection.dart + models.dart — new characteristic UUID and listener follow the existing pattern; base-class default returns null so other connectors are unaffected.
  • l10n (49 locales) — one nit: app_en.arb adds @singleTap/@singleTapAction description metadata but not @tripleTap/@tripleTapAction, so the generated dart shows "No description provided" for those two. Cosmetic, but worth adding for consistency.
  • docs/onboarding/omi.mdx — the updated card text matches the implemented behavior (defaults, Off option, the instant-response note when unmapped taps are turned off).

All checks are green, including the new firmware host test. The maintainers have already approved this head, so this is in good shape — the remaining product call (e.g. whether triple tap's default should end the conversation, per #2825) stays with them before merge.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

…-action

Main rebuilt the device page on the lib/ui primitives and pulled the
button handler out of its closure, so both halves are ported:

- The tap rows are OmiSettingsRows in _customizationGroup and the three
  pickers share one sheet in device_control_sheets.dart.
- _handleButtonEvent routes single and double tap through
  _runButtonAction and steps aside for a device that reports tap counts.
  The ask-a-question toggle is main's code moved into
  _toggleVoiceQuestion, so the tap path shares the auto-submit grace and
  the drop telemetry.
- Main fixed the trailing release on its own, so that fix and its tests
  are dropped here.
- ScriptedDeviceConnection answers the feature query and can emit tap
  counts, since the tap path asks every connection for its features.
- The two new preferences live in button_action.dart, because main keeps
  preferences.dart at 1500 lines.
@singhharsh1708

Copy link
Copy Markdown
Contributor Author

Merged main and ported both halves onto it: the rows onto the new device page, and the tap dispatch onto the extracted _handleButtonEvent. The description is rewritten for this head, and the tripleTap descriptions from the last review are in.

Renders through the visual audit harness (the production widgets in flutter-tester, no device behind them). The page has no paired device in this render, so it shows the single and double tap rows; the triple tap and Turn Off rows need firmware with bit 9.

tap rows
single tap sheet

Double tap with Off, and triple tap:

double tap sheet
triple tap sheet

Fork CI skips the Dart jobs without ci:full. Could a maintainer add the label and re-run, so the suite runs on this head?

@singhharsh1708
singhharsh1708 marked this pull request as ready for review October 9, 2026 20:36
…-action

Only app_en.arb conflicted: main appended new strings where the triple
tap descriptions sat, so the descriptions are re-added after them.
@Git-on-my-level

Copy link
Copy Markdown
Member

The implementation is in good shape and the backward-compatibility story is careful — one robustness gap in the tap-stream setup below, plus a hardware-verification ask. No blocking correctness issue found in review.

What I verified:

  • omi/firmware/omi/src/lib/core/tap_sequence.h — clean state machine (press <300 ms counts, 350 ms gap ends the sequence, a hold >=300 ms ends it while still held so the long-press power-off stays untouched), and omi/firmware/omi/tests/tap_sequence/tap_sequence_test.c covers single/double/triple, gap timing, hold-after-tap and uptime wraparound. Keeping it Zephyr-free with a host test is a nice design.
  • app/lib/services/capture/button_action.dart — ButtonTapDispatcher fires the highest mapped count on the tap itself and defers lower counts to the sequence end; the resolve* functions keep the existing doubleTapAction encoding so existing prefs are unaffected.
  • app/lib/services/capture/capture_controller.dart — legacy stream unchanged for old firmware, onboarding step 1 still forces ask-a-question, and the Omi button-actions switch is honoured on both streams. One gap: in _streamButtonTaps, _buttonTapsActive is set from the feature bit alone, but performGetBleButtonTapsListener (omi_connection.dart) catches transport errors and returns null — if the subscription fails to attach, _onButtonEvent's _buttonTapsActive early-return leaves the device with no button handling at all outside onboarding. Consider setting _buttonTapsActive only once the subscription actually attaches, or falling back to the legacy stream on null.
  • omi/firmware/omi/src/lib/core/button.c — the new 23ba7926 characteristic notifies on &button_service.attrs[4], mirroring the existing attrs[1] convention for 23ba7925; the legacy characteristic and its payload are untouched, so shipped apps and onboarding are unaffected. The PR body doesn't mention on-device verification of the new characteristic, and the tap stream is only exercised through ScriptedDeviceConnection — a note (logs or a clip) of it working on a real CV1 would raise confidence before merge.
  • app/lib/pages/settings/device_settings.dart — nice details: a stored Off stays selectable when the device can't report tap support, and the fixed long-press row only appears on bit-9 firmware.

UX: with the defaults on bit-9 firmware, a single tap now waits out the ~350 ms sequence window before starting a question (so double/triple can still fire); turning the higher taps off makes it instant. Blast radius: new behaviour is gated on feature bit 9 — older firmware keeps today's behaviour exactly.

USER IMPACT: on updated firmware, users can remap single, double and triple tap in Settings -> Device; defaults stay as today (a single tap's question start gains up to ~350 ms of latency), and older firmware is unchanged.

Still wanted before merge:

  1. Guard the _buttonTapsActive null-subscription case in capture_controller.dart so a failed tap subscription falls back to the legacy stream.
  2. On-device confirmation that notifications on 23ba7926 arrive — the one path CI can't exercise.

Leaving for human maintainer review: this adds a new BLE characteristic and feature-bit protocol across firmware and app, and the existing maintainer approvals predate the current head.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: solid, well-scoped implementation — a clean extension of the existing double-tap configuration to single and triple taps with a firmware-side tap recogniser, careful legacy back-compat, and unusually good test coverage. No blocking issues found; a few follow-ups below.

What I verified:

  • omi/firmware/omi/src/lib/core/tap_sequence.h — compact header-only recogniser (300ms max press, 350ms gap) that reports TAP on each short release and exactly one END per sequence; timing uses (now_ms - prev) deltas so uptime wraparound is safe, and the host-compiled tests in omi/firmware/omi/tests/tap_sequence/ cover double/triple taps, hold-after-tap, hold-only, and wraparound.
  • omi/firmware/omi/src/lib/core/button.c — new 23ba7926 taps characteristic notifies via &button_service.attrs[4], the same declaration-attribute pattern the existing button-data notify uses with attrs[1], so it's consistent with the working convention here.
  • app/lib/services/capture/button_action.dart — ButtonTapDispatcher fires on the tap itself only when no longer tap is mapped, otherwise defers to sequence end; tests cover double-fire protection, missed-END recovery, and off-mapped counts.
  • app/lib/services/capture/capture_controller.dart — the legacy button stream is suppressed once _buttonTapsActive (new firmware isn't handled twice) while onboarding keeps reading it, and legacy firmware keeps today's behaviour. The single-tap remap on the legacy path goes through resolveSingleTapActionForSession, so onboarding step 1 still forces ask-a-question. Good.
  • app/lib/pages/settings/device_settings.dart / device_control_sheets.dart — the triple-tap row and double-tap "Off" are gated behind the buttonTaps feature bit (with a stored Off kept selectable on older firmware), matching OMI_FEATURE_BUTTON_TAPS; models.dart/devices.dart mirror the firmware's 1 << 9 on both sides.
  • docs/onboarding/omi.mdx matches the actual gating, changelog fragment present, l10n keys added across locales, and the firmware test is registered in .github/checks-manifest.yaml.

Notes (non-blocking):

  • Minor race: _buttonTapsActive resolves after an await in _streamButtonTaps, so a legacy event landing in that window could be handled once by both paths. Transient, low risk.
  • Analytics: only double taps emit omiDoubleTap events (trackDoubleTap: count == 2); single/triple actions are currently uninstrumented.

Still wanted before merge:

  • "Dart Analyze & Tests" shows skipped on this head despite the large app/ change — please confirm the app suite ran somewhere on this head.
  • The new firmware-button-tap-sequence-tests manifest check isn't visible in this PR's checks; confirm it's wired into CI (it should trigger on tap_sequence.h).
  • An on-device smoke of triple tap and double-tap "Off" on CV1 firmware would be ideal.

USER IMPACT: On firmware with tap counting, users can now choose what single, double and triple taps do (Settings → Device Settings); the highest mapped tap responds immediately, lower ones respond after a short (~0.35s) wait.

Leaving for human maintainer re-approval: the last maintainer approval predates the current head, and the dispatcher's wait-vs-fire tradeoff is a product-visible latency decision worth a maintainer's sign-off.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work needs-maintainer-review Needs a human maintainer to sign off before merge positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

increased button functionality + customizable buttons ($500)

3 participants