Skip to content

Commit

Permalink
fdl: active: Improve timeout response timing
Browse files Browse the repository at this point in the history
After detecting a slot timeout, the active station would need one more
poll cycle to actually start transmitting again.  Fix this by
immediately executing the new state handler which will schedule a new
transmission right away.
  • Loading branch information
Rahix committed Nov 24, 2024
1 parent 834d1bb commit 0d40f39
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/fdl/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,9 +1061,13 @@ impl FdlActiveStation {
app.handle_timeout(now, self, address);
self.state.transition_use_token(data);
*self.state.get_use_token_first_cycle_done() = true;
}

PollDone::waiting_for_bus()
// Immediately evaluate UseToken state because the bus is free for immediate
// transmission
self.do_use_token(now, phy, apps)
} else {
PollDone::waiting_for_bus()
}
}

#[must_use = "poll done marker"]
Expand Down Expand Up @@ -1169,7 +1173,9 @@ impl FdlActiveStation {
log::trace!("No reply from #{address}");
self.state
.transition_pass_token(false, PassTokenAttempt::First);
PollDone::waiting_for_delay()
// Immediately evaluate PassToken state because the bus is free for immediate
// transmission
self.do_pass_token(now, phy)
} else {
PollDone::waiting_for_bus()
}
Expand Down Expand Up @@ -1213,7 +1219,9 @@ impl FdlActiveStation {
.transition_pass_token(false, PassTokenAttempt::First);
}
}
return PollDone::waiting_for_delay();
// Immediately evaluate PassToken state because the bus is free for immediate
// transmission
return self.do_pass_token(now, phy);
}

phy.receive_telegram(now, |telegram| {
Expand Down

0 comments on commit 0d40f39

Please sign in to comment.