Skip to content

Implement GAP scan in ClaimToken state#28

Merged
Rahix merged 6 commits into
mainfrom
claim-token
May 30, 2026
Merged

Implement GAP scan in ClaimToken state#28
Rahix merged 6 commits into
mainfrom
claim-token

Conversation

@Rahix
Copy link
Copy Markdown
Owner

@Rahix Rahix commented May 30, 2026

After claiming a lost token, the active station is required to perform a full GAP scan to immediately find the next station (NS). Right now, the next station is only acquired late when the "passive" GAP poll stumbles upon it.

Factor out the GAP poll logic and reuse it to GAP scan in the ClaimToken state.

Also immediately pass the token to the NS after this scan completes, rather than starting with using the token.

Fixes #25.

Rahix added 6 commits May 30, 2026 11:03
This is in preparation for later reusing this code during claim token
processing where we will need to perform a full gap-poll as well.
This is in preparation for later reusing this code during claim token
processing where we will need to perform a full gap-poll as well.

Currently, the implementation plays it safe and any bad telegram we
receive will cause the active station to back off from the bus.  We
should probably differentiate here in the future and only back off when
a different station responds.
The slot_time_timing() test should not expect the active station to
respond with a token telegram after the status request. This may not
always be the case, for example when the status request is sent as part
of a claim-token gap poll.
After claiming a lost token, the active station must immediately scan
its full GAP before stating to make use of the token. Implement this
using the factored out GAP scanning logic from the previous commits.
Ensure the active station peforms a full GAP scan before doing anything
else after claiming a lost token.
After claiming a lost token, the active station performs a full GAP
scan. When this completes, it must pass on the token to the next active
station immediately, instead of starting to make use of the token
itself.

Also ensure this behavior using the test.
@Rahix Rahix merged commit c30cdf3 into main May 30, 2026
6 checks passed
@Rahix Rahix deleted the claim-token branch May 30, 2026 10:25
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.

do_claim_token() must immediately scan the GAP to find the NS

1 participant