Skip to content

Unify multi-bus device buttons into single button with bus picker#28

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/update-add-device-button
Draft

Unify multi-bus device buttons into single button with bus picker#28
Copilot wants to merge 3 commits intomainfrom
copilot/update-add-device-button

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Devices that work on both I2C and SPI (e.g., Pinnacle trackpad) were shown as separate buttons. Now they appear as a single button that reveals all available bus options.

Changes

src/components/controllerInfo.ts

  • Added DeviceGroup interface and deviceGroups registry for grouping device variants
  • Precomputed reverse lookup map for O(1) device-to-group resolution

src/components/controller/BusDevicesConfigurator.tsx

  • Collapse grouped variants into single DeviceOption entries
  • Popover shows buses for all variants in the group

Usage

Add new multi-bus devices by updating the registry only:

export const deviceGroups: Readonly<Record<string, DeviceGroup>> = {
  pinnacle: {
    displayName: "Pinnacle",
    variants: ["pinnacle_i2c", "pinnacle_spi"],
  },
};

Screenshot

pinnacle-add-device-multi-bus

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astro.build
    • Triggering command: /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-uAGTt2 -juggler-pipe -silent (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-Fn0oEV -juggler-pipe -silent (dns block)
  • aus5.mozilla.org
    • Triggering command: /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-uAGTt2 -juggler-pipe -silent (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-Fn0oEV -juggler-pipe -silent (dns block)
  • docs.astro.build
    • Triggering command: /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-uAGTt2 -juggler-pipe -silent (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox /home/REDACTED/.cache/ms-playwright/firefox-1497/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-Fn0oEV -juggler-pipe -silent (dns block)
  • sparrow.cloudflare.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/zmk-wizard/zmk-wizard/node_modules/.pnpm/wrangler@4.56.0_@cloudflare&#43;workers-types@4.20251228.0/node_modules/wrangler/wrangler-dist/cli.js types (dns block)
  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/zmk-wizard/zmk-wizard/node_modules/.bin/../astro/astro.js dev /home/REDACTED/work/zmk-wizard/zmk-wizard/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/index.js/../entry/process.js (dns block)
  • workers.cloudflare.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/zmk-wizard/zmk-wizard/node_modules/.pnpm/wrangler@4.56.0_@cloudflare&#43;workers-types@4.20251228.0/node_modules/wrangler/wrangler-dist/cli.js types (dns block)
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/zmk-wizard/zmk-wizard/node_modules/.bin/../astro/astro.js dev /home/REDACTED/work/zmk-wizard/zmk-wizard/node_modules/.pnpm/tinypool@1.1.1/node_modules/tinypool/dist/index.js/../entry/process.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add DeviceGroup interface and deviceGroups registry in controllerInfo.ts
- Add getDeviceGroup helper function to find device groups
- Update BusDevicesConfigurator.tsx to show single button for grouped devices
- Clicking grouped device button shows all available bus options (I2C and SPI)

Co-authored-by: Genteure <11240579+Genteure@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 31, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
shield-wizard aae03eb Commit Preview URL

Branch Preview URL
Jan 31 2026, 10:32 AM

- Use a precomputed reverse lookup map for O(1) device-to-group lookup
- Return group key along with group data for reliable deduplication
- Use groupKey instead of displayName for comparing options

Co-authored-by: Genteure <11240579+Genteure@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow single button to add devices for I2C and SPI Unify multi-bus device buttons into single button with bus picker Jan 31, 2026
Copilot AI requested a review from Genteure January 31, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants