Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative: Add configuration commands to MicrobitSerial #201

Merged
merged 3 commits into from
Jan 30, 2024

Conversation

microbit-matt-hillsdon
Copy link

@microbit-matt-hillsdon microbit-matt-hillsdon commented Jan 30, 2024

As per #196 but reuses the request/response code for the handshake and sticks to one listener processing incoming data.

I've dropped the state field for now as we didn't really make much use of it after this change as state is now really held by the caller of the listenToInputServices and states during that call aren't useful anymore. I guess we could use it to ignore unexpected incoming periodic data but I think it's likely fine for the UI to always reflect what's going on with incoming data.

Until we test it for real I have litte/no faith in partial reconnections so planning to leave Rob to try those once his initial work as landed.

Copy link

Preview build will be at
https://review-ml.microbit.org/alt-proto-setup/thenextgen/

Comment on lines 86 to 94
const messageResponse = protocol.processResponseMessage(msg);
if (!messageResponse) {
return;
}
const responseResolve = this.responseMap.get(messageResponse.messageId);
if (responseResolve) {
this.responseMap.delete(messageResponse.messageId);
responseResolve(messageResponse);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we are struggling with performance, we could avoid doing this on every periodic message by either returning at the end of the if (sensorData) {} scope or only running this code if sensorData was undefined.

Choose a reason for hiding this comment

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

Absolutely, thanks. 3dcd962

@microbit-matt-hillsdon microbit-matt-hillsdon marked this pull request as ready for review January 30, 2024 15:54
@microbit-matt-hillsdon microbit-matt-hillsdon changed the title Alernative: Add configuration commands to MicrobitSerial Alternative: Add configuration commands to MicrobitSerial Jan 30, 2024
@microbit-matt-hillsdon microbit-matt-hillsdon merged commit c941f58 into main Jan 30, 2024
1 check passed
@microbit-matt-hillsdon microbit-matt-hillsdon deleted the alt-proto-setup branch January 30, 2024 18:48
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.

None yet

2 participants