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

CAN: Request/response fixes #53

Merged
merged 4 commits into from
Aug 12, 2024
Merged

Conversation

garethpotter
Copy link
Collaborator

A few things here:

  • request/response timer should start straight away rather than after timeout
  • the CAN ID should be passed to the request/response sent callback (rather than 0)
  • the sent callback should be called on success, not just on failure

src/can.c Outdated Show resolved Hide resolved
src/can.c Outdated Show resolved Hide resolved
if (result == 0) {
/* maintain unlocking semantics of previous iteration of this code */
struct shared_buffer *sbuf = thingset_sdk_shared_buffer();
k_sem_give(&sbuf->lock);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering why we are unlocking the buffer here at all, as the shared buffer doesn't seem to be used by the thingset_can_send_inst function. Only at my phone at the moment, so it's difficult to check the entire code flow...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's somewhat lost in the mists of time now, but I think the rationale was that we only want to unlock the buffer once the message has been successfully sent. I agree that it's a bit odd. In truth, the whole thing probably wants a bit of a rethink, but I figured this approach at least wouldn't make things any worse.

@martinjaeger martinjaeger merged commit da089bd into ThingSet:main Aug 12, 2024
1 check passed
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