LinkWirelessMultiboot: Implementing waitForReadySignal correctly

This commit is contained in:
Rodrigo Alfonso
2025-01-26 21:05:41 -03:00
parent b2b7c0986f
commit dd1735fb76
2 changed files with 6 additions and 9 deletions

View File

@@ -344,8 +344,8 @@ This version (`LinkWirelessMultiboot::Async`) allows more advanced use cases lik
| `getResult([clear])` | **LinkWirelessMultiboot::Async::Result** | Returns the result of the last operation. <br/><br/>After this call, the result is cleared if `clear` is `true` (default behavior). |
| `playerCount()` | **u8** _(1~5)_ | Returns the number of connected players. |
| `getPercentage()` | **u32** _(0~100)_ | Returns the completion percentage. |
| `isReady()` | **bool** | Returns whether the ready mark is active or not. <br/><br/>This is only useful when using the `waitForReadySignal` parameter. |
| `markReady()` | **bool** | Marks the transfer as ready. <br/><br/>This is only useful when using the `waitForReadySignal` parameter. |
| `isReady()` | **bool** | Returns whether the ready mark is active or not. |
| `markReady()` | **bool** | Marks the transfer as ready. |
⚠️ never call `reset()` inside an interrupt handler!

View File

@@ -848,15 +848,11 @@ class LinkWirelessMultiboot {
/**
* @brief Returns whether the ready mark is active or not.
* \warning This is only useful when using the `waitForReadySignal`
* parameter.
*/
[[nodiscard]] bool isReady() { return dynamicData.ready; }
/**
* @brief Marks the transfer as ready.
* \warning This is only useful when using the `waitForReadySignal`
* parameter.
*/
void markReady() {
if (state == STOPPED)
@@ -1241,9 +1237,10 @@ class LinkWirelessMultiboot {
};
void startOrKeepListening() {
if ((linkRawWireless.playerCount() < fixedData.players &&
!dynamicData.ready) ||
linkRawWireless.playerCount() <= 1) {
if (linkRawWireless.playerCount() <= 1 ||
(fixedData.waitForReadySignal && !dynamicData.ready) ||
(linkRawWireless.playerCount() < fixedData.players &&
!dynamicData.ready)) {
state = LISTENING;
return (void)pollConnections();
}