Skip to content

[Accessories] 7 - Separate firmware device profiles #483

Description

@KacperKozak

Parent

#475

What to build

Refactor vescape-app/vescape-accessories into shared firmware libraries and explicitly selected device profiles. Preserve working ground-clearance behavior and protocol v1. This work prepares the firmware structure used by #480 and #481.

Separate BLE transport, protocol/session/lease runtime, ground-clearance capability behavior, and VL53L0X hardware I/O. Keep runtime state owned by one loop/task, with bounded queued BLE events and serialized outgoing messages. Use small concrete interfaces and explicit capability composition; no dynamic plugin system or hypothetical joystick implementation.

Provide separately buildable clearance and explicitly development-only fake rear-light profiles for XIAO ESP32-S3. Isolate sensor dependencies from the light build. Preserve existing supported board configurations where practical. The clearance profile must not advertise the spike's dummy brake light. Keep accessory identity and clearance capability IDs stable across ordinary updates.

Likely files

All paths below are in vescape-app/vescape-accessories.

  • src/main.cpp — current mixed entrypoint to reduce to composition/startup.
  • lib/accessory/ — existing Arduino-free protocol library and extension starting point.
  • platformio.ini — device profiles and scoped dependencies.
  • test/ — protocol fixtures and new meaningful runtime regression tests.
  • docs/accessories.md — architecture, profiles, capability declarations and extension instructions.
  • docs/flashing.md — exact build/upload commands and existing XIAO automatic reset settings.

Acceptance criteria

  • Ground-clearance measurement rates/statuses, standby, session sequencing and lease behavior remain intact.
  • Session reset, disconnect, command expiry and duplicate commands are covered with deterministic desktop tests.
  • BLE callbacks cannot concurrently mutate capability or protocol runtime; stale connection events cannot affect a new session.
  • Clearance and fake rear-light XIAO firmware both compile, with VL53L0X excluded from the light build.
  • The fake profile is explicitly labeled as development-only; full brake-light rendering remains [Accessories] 5 - Drive brake-light states #480.
  • Protocol fixtures pass without changes to the wire contract.
  • Build/flash documentation and instructions for adding a driver versus adding a capability are current.
  • No flashing or claims of hardware validation in this task; those belong to [Accessories] 6 - Validate connected riding #481.

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:accessoriesAccessory discovery, protocol, configuration, and Board bindingscomplexity:highCritical paths, subtle correctness, native pipelines. Use opus.enhancementNew feature or requestready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions