-
Notifications
You must be signed in to change notification settings - Fork 56
Don't give up when missing the initial transmit window #155
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct, thanks!
Did you manage to test this, by chance?
rubble/src/link/connection.rs
Outdated
@@ -57,6 +57,9 @@ pub struct Connection<C: Config> { | |||
/// Contains the *instant* at which it should be applied to the Link Layer state. | |||
update_data: Option<LlcpUpdate>, | |||
|
|||
/// 'transmitWindowSize' of current connection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// 'transmitWindowSize' of current connection. | |
/// `transmitWindowSize` of current connection. |
I haven't yet tested it on hardware, p.s. |
I made a force-push to squash the follow-up fix with the previous commit. |
return Ok(Cmd { | ||
next_update: NextUpdate::At( | ||
// Move the transmit window forward by the `connInterval`. | ||
timer.now() + self.connection_interval(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, so I think if this fetches the current time via timer.now()
this will cause the window to shift slightly each time it is missed. Instead, we should set the timer to expire at the previous update time plus the connection interval. This will always shift the window by the connInterval
.
Note that the first update time has an additional 500 µs added to account for imprecisions, so that has to be accounted for. I guess we'll have to store it in the Connection
after all.
Hello 🦀 , this PR aims to close #77.
In the example from bluetooth specs (5.2) where the master misses the initial transmit window, the slave hops to a new channel for the next connection event. So I followed the example, to hop channels when the master device misses the initial transmit window.
Thank you for reviewing this PR ! 😸