diff options
| author | 2023-05-13 00:04:18 -0600 | |
|---|---|---|
| committer | 2023-05-14 09:04:37 -0600 | |
| commit | ac531aa15f35b2e6584b8b306b5c3258ef66dc73 (patch) | |
| tree | da0924d367e338345a22449e64fc01e474c2d2c3 /src/input_common/helpers/joycon_protocol/nfc.cpp | |
| parent | Merge pull request #10244 from liamwhite/lower-upper (diff) | |
| download | yuzu-ac531aa15f35b2e6584b8b306b5c3258ef66dc73.tar.gz yuzu-ac531aa15f35b2e6584b8b306b5c3258ef66dc73.tar.xz yuzu-ac531aa15f35b2e6584b8b306b5c3258ef66dc73.zip | |
input_common: Make amiibo scanning less demanding
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/nfc.cpp')
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/nfc.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/input_common/helpers/joycon_protocol/nfc.cpp b/src/input_common/helpers/joycon_protocol/nfc.cpp index 77ea6d5cf..14818ae33 100644 --- a/src/input_common/helpers/joycon_protocol/nfc.cpp +++ b/src/input_common/helpers/joycon_protocol/nfc.cpp | |||
| @@ -72,6 +72,11 @@ DriverResult NfcProtocol::StartNFCPollingMode() { | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) { | 74 | DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) { |
| 75 | if (update_counter++ < AMIIBO_UPDATE_DELAY) { | ||
| 76 | return DriverResult::Delayed; | ||
| 77 | } | ||
| 78 | update_counter = 0; | ||
| 79 | |||
| 75 | LOG_DEBUG(Input, "Start NFC pooling Mode"); | 80 | LOG_DEBUG(Input, "Start NFC pooling Mode"); |
| 76 | ScopedSetBlocking sb(this); | 81 | ScopedSetBlocking sb(this); |
| 77 | DriverResult result{DriverResult::Success}; | 82 | DriverResult result{DriverResult::Success}; |
| @@ -87,7 +92,7 @@ DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) { | |||
| 87 | result = WaitUntilNfcIsReady(); | 92 | result = WaitUntilNfcIsReady(); |
| 88 | } | 93 | } |
| 89 | if (result == DriverResult::Success) { | 94 | if (result == DriverResult::Success) { |
| 90 | result = StartPolling(tag_data); | 95 | result = StartPolling(tag_data, 7); |
| 91 | } | 96 | } |
| 92 | if (result == DriverResult::Success) { | 97 | if (result == DriverResult::Success) { |
| 93 | result = GetAmiiboData(data); | 98 | result = GetAmiiboData(data); |
| @@ -129,9 +134,8 @@ DriverResult NfcProtocol::WaitUntilNfcIsReady() { | |||
| 129 | return DriverResult::Success; | 134 | return DriverResult::Success; |
| 130 | } | 135 | } |
| 131 | 136 | ||
| 132 | DriverResult NfcProtocol::StartPolling(TagFoundData& data) { | 137 | DriverResult NfcProtocol::StartPolling(TagFoundData& data, std::size_t timeout_limit) { |
| 133 | LOG_DEBUG(Input, "Start Polling for tag"); | 138 | LOG_DEBUG(Input, "Start Polling for tag"); |
| 134 | constexpr std::size_t timeout_limit = 7; | ||
| 135 | MCUCommandResponse output{}; | 139 | MCUCommandResponse output{}; |
| 136 | std::size_t tries = 0; | 140 | std::size_t tries = 0; |
| 137 | 141 | ||