Fixing stop method and other stuff

This commit is contained in:
Rodrigo Alfonso
2025-01-23 05:51:25 -03:00
parent 64d948db25
commit 00d327b867
6 changed files with 12 additions and 10 deletions

View File

@@ -177,7 +177,7 @@ This version (`LinkCableMultiboot::Async`) allows more advanced use cases like p
| `reset()` | - | Deactivates the library, canceling the in-progress transfer, if any. |
| `getState()` | **LinkCableMultiboot::Async::State** | Returns the current state. |
| `getResult([clear])` | **LinkCableMultiboot::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** | Returns the number of connected players (`1~4`). |
| `playerCount()` | **u8** _(1~4)_ | Returns the number of connected players. |
| `getPercentage()` | **u32** | 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. |

View File

@@ -1015,8 +1015,11 @@ class LinkCableMultiboot {
}
void stop(Result newResult = NONE) {
auto mode = fixedData.transferMode;
resetState(newResult);
if (fixedData.transferMode == TransferMode::MULTI_PLAY)
if (mode == TransferMode::MULTI_PLAY)
linkRawCable.deactivate();
else
linkSPI.deactivate();

View File

@@ -724,9 +724,9 @@ class LinkRawWireless {
rawData[0] = header;
for (u32 i = 0; i < dataSize; i++)
rawData[i + 1] = data[i];
dataSize++;
bool success = sendCommand(COMMAND_SEND_DATA, rawData, dataSize).success;
bool success =
sendCommand(COMMAND_SEND_DATA, rawData, 1 + dataSize).success;
if (!success) {
_resetState();
@@ -757,9 +757,8 @@ class LinkRawWireless {
rawData[0] = header;
for (u32 i = 0; i < dataSize; i++)
rawData[i + 1] = data[i];
dataSize++;
if (!sendCommand(COMMAND_SEND_DATA_AND_WAIT, rawData, dataSize, true)
if (!sendCommand(COMMAND_SEND_DATA_AND_WAIT, rawData, 1 + dataSize, true)
.success) {
_resetState();
return false;

View File

@@ -194,7 +194,7 @@ class LinkUniversal {
[[nodiscard]] bool isConnected() { return state == CONNECTED; }
/**
* @brief Returns the number of connected players (`0~5`).
* @brief Returns the number of connected players (`1~5`).
*/
[[nodiscard]] u8 playerCount() {
return mode == LINK_CABLE ? linkCable.playerCount()

View File

@@ -670,14 +670,14 @@ class LinkWireless {
}
/**
* @brief Returns the number of connected players.
* @brief Returns the number of connected players (`1~5`).
*/
[[nodiscard]] u8 playerCount() {
return linkRawWireless.sessionState.playerCount;
}
/**
* @brief Returns the current player ID.
* @brief Returns the current player ID (`0~4`).
*/
[[nodiscard]] u8 currentPlayerId() {
return linkRawWireless.sessionState.currentPlayerId;

View File

@@ -526,7 +526,7 @@ class LinkWirelessMultiboot {
u32 _bytes,
LinkRawWireless::ReceiveDataResponse& response) {
LinkRawWireless::CommandResult remoteCommand;
volatile bool success = false;
bool success = false;
success =
linkRawWireless.sendDataAndWait(data, dataSize, remoteCommand, _bytes);