mirror of
https://github.com/afska/gba-link-connection.git
synced 2026-03-21 17:44:21 -05:00
FIX: LinkRawWireless enables the library before calling any action
This commit is contained in:
parent
6868ca18cd
commit
dcbdf37250
|
|
@ -229,11 +229,16 @@ class LinkRawWireless {
|
|||
bool activate(bool _stopFirst = true) {
|
||||
LINK_READ_TAG(LINK_RAW_WIRELESS_VERSION);
|
||||
|
||||
LINK_BARRIER;
|
||||
isEnabled = false;
|
||||
LINK_BARRIER;
|
||||
|
||||
bool success = reset(_stopFirst);
|
||||
|
||||
LINK_BARRIER;
|
||||
isEnabled = true;
|
||||
LINK_BARRIER;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
@ -246,10 +251,16 @@ class LinkRawWireless {
|
|||
* \warning This should be used as a replacement for `activate()`.
|
||||
*/
|
||||
bool restoreExistingConnection() {
|
||||
LINK_BARRIER;
|
||||
isEnabled = false;
|
||||
LINK_BARRIER;
|
||||
|
||||
_resetState();
|
||||
|
||||
LINK_BARRIER;
|
||||
isEnabled = true;
|
||||
LINK_BARRIER;
|
||||
|
||||
_LRWLOG_("setting SPI to 2Mbps");
|
||||
linkSPI.activate(LinkSPI::Mode::MASTER_2MBPS);
|
||||
|
||||
|
|
@ -286,7 +297,6 @@ class LinkRawWireless {
|
|||
|
||||
_LRWLOG_("restored ok!");
|
||||
|
||||
isEnabled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -296,14 +296,17 @@ class LinkWireless {
|
|||
static_assert(LINK_WIRELESS_MAX_CLIENT_TRANSFER_LENGTH >= 2 &&
|
||||
LINK_WIRELESS_MAX_CLIENT_TRANSFER_LENGTH <= 4);
|
||||
|
||||
lastError = Error::NONE;
|
||||
LINK_BARRIER;
|
||||
isEnabled = false;
|
||||
|
||||
LINK_BARRIER;
|
||||
|
||||
lastError = Error::NONE;
|
||||
bool success = reset();
|
||||
|
||||
LINK_BARRIER;
|
||||
isEnabled = true;
|
||||
LINK_BARRIER;
|
||||
|
||||
isEnabled = true;
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
@ -316,7 +319,9 @@ class LinkWireless {
|
|||
* \warning This should be used as a replacement for `activate()`.
|
||||
*/
|
||||
bool restoreExistingConnection() {
|
||||
LINK_BARRIER;
|
||||
isEnabled = false;
|
||||
LINK_BARRIER;
|
||||
|
||||
resetState();
|
||||
stopTimer();
|
||||
|
|
@ -328,7 +333,10 @@ class LinkWireless {
|
|||
return false;
|
||||
}
|
||||
|
||||
LINK_BARRIER;
|
||||
isEnabled = true;
|
||||
LINK_BARRIER;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user