Revising sync() documentation, again

This commit is contained in:
Rodrigo Alfonso 2025-01-05 09:33:22 -03:00
parent afb05da665
commit f672bd7c3e
3 changed files with 7 additions and 10 deletions

View File

@ -119,7 +119,7 @@ You can also change these compile-time constants:
| `isConnected()` | **bool** | Returns `true` if there are at least 2 connected players. |
| `playerCount()` | **u8** _(0~4)_ | Returns the number of connected players. |
| `currentPlayerId()` | **u8** _(0~3)_ | Returns the current player ID. |
| `sync()` | - | Call this method whenever you need to fetch new data. It does not **wait** for new messages; instead, it collects and queues any available messages from the interrupt world for later processing with the `read(...)` method. |
| `sync()` | - | Collects available messages from interrupts for later processing with `read(...)`. Call this method whenever you need to fetch new data. |
| `waitFor(playerId)` | **bool** | Waits for data from player #`playerId`. Returns `true` on success, or `false` on disconnection. |
| `waitFor(playerId, cancel)` | **bool** | Like `waitFor(playerId)` but accepts a `cancel()` function. The library will continuously invoke it, and abort the wait if it returns `true`. |
| `canRead(playerId)` | **bool** | Returns `true` if there are pending messages from player #`playerId`. Keep in mind that if this returns `false`, it will keep doing so until you _fetch new data_ with `sync()`. |

View File

@ -166,10 +166,8 @@ class LinkCable {
[[nodiscard]] u8 currentPlayerId() { return state.currentPlayerId; }
/**
* @brief Call this method whenever you need to fetch new data. It does not
* **wait** for new messages; instead, it collects and queues any available
* messages from the interrupt world for later processing with the `read(...)`
* method.
* @brief Collects available messages from interrupts for later processing
* with `read(...)`. Call this method whenever you need to fetch new data.
*/
void sync() {
if (!isEnabled)

View File

@ -210,11 +210,10 @@ class LinkUniversal {
}
/**
* @brief Call this method whenever you need to fetch new data, but at least
* once per frame, as it also maintains the connection state. It does not
* **wait** for new messages; instead, it collects and queues any available
* messages from the interrupt world for later processing with the `read(...)`
* method.
* @brief Collects available messages from interrupts for later processing
* with `read(...)`. Call this method whenever you need to fetch new data, and
* at least once per frame, as it also manages connection state, auto-pairing,
* and protocol switching.
*/
void sync() {
if (!isEnabled)