Skip to content

Add event service for gestures, button actions, and raw message bus events#124

Open
microbit-matt-hillsdon wants to merge 4 commits intoappsfrom
event-service3
Open

Add event service for gestures, button actions, and raw message bus events#124
microbit-matt-hillsdon wants to merge 4 commits intoappsfrom
event-service3

Conversation

@microbit-matt-hillsdon
Copy link
Contributor

Pin events can be added as a high-level feature later if there's demand. They make much less sense for a general purpose "control/monitor the micro:bit over BLE" program. Though maybe useful for digital twin projects as they can observe pins without changing the pin mode (but can't read values, just transitions).

For now they're accessible via the numeric API with CODAL/DAL constants in the user program.

I do slightly wonder what the point of the button service is now...

…vents

Pin events can be added as a high-level feature later if there's demand.

For now they're accessible via the numeric API with CODAL/DAL constants in the
user program.
@microbit-matt-hillsdon
Copy link
Contributor Author

For discussion/experimentation rather than a quick review + merge.

@microbit-grace
Copy link
Contributor

microbit-grace commented Mar 26, 2026

Had a play and it looks good.

It was a bit unexpected that the Gestures section would affect the Raw Events section. Listening to gestures would cause it to stream raw events, and stopping listening to the gestures would not stop gesture raw events, but after some thought, it makes sense because gestures get subscribed.

Also, not sure if there is a root for getting the touch logo press event as well.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 26, 2026

Deploying microbit-connection with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6d84c6a
Status:🚫  Build failed.

View logs

- Add logoaction named event for V2 logo touch button (source 121),
  reusing ButtonActionData with button: "Logo"
- Fix reconnect bug: BLE notification callback was not re-registered
  after disconnect because notificationsStarted flag persisted
- Separate named vs explicit subscription filters so microbitevent
  only dispatches events from subscribeToEvent calls
- Add Logo row to demo Button Events section
@microbit-matt-hillsdon
Copy link
Contributor Author

I've tried to separate out the notifications so you only get low level ones if you ask for them.

I've added the logo as a button and it seems to work well.

I also added detail to the demo about what requires what service as otherwise the split of the button-related behaviours is inexplicable (similar to JSDoc already added).

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