Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 49a45cc

Browse filesBrowse files
authored
[WiFiScan] Fix clear 'scanning bit' and clear scanCount
`WIFI_SCANNING_BIT` may not always be cleared on timeout. Also `_scanCount` will only be cleared if there is a `_scanResult`. See: #8952
1 parent bda7c48 commit 49a45cc
Copy full SHA for 49a45cc

File tree

1 file changed

+6
-4
lines changed
Filter options

1 file changed

+6
-4
lines changed

‎libraries/WiFi/src/WiFiScan.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiScan.cpp
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ int16_t WiFiScanClass::scanComplete() {
160160
return WiFiScanClass::_scanCount;
161161
}
162162

163-
if (WiFiGenericClass::getStatusBits() & WIFI_SCANNING_BIT) {
164-
return WIFI_SCAN_RUNNING;
165-
}
166163
// last one to avoid time affecting Async mode
167164
if (WiFiScanClass::_scanStarted
168165
&& (millis() - WiFiScanClass::_scanStarted)
@@ -171,6 +168,10 @@ int16_t WiFiScanClass::scanComplete() {
171168
return WIFI_SCAN_FAILED;
172169
}
173170

171+
if (WiFiGenericClass::getStatusBits() & WIFI_SCANNING_BIT) {
172+
return WIFI_SCAN_RUNNING;
173+
}
174+
174175
return WIFI_SCAN_FAILED;
175176
}
176177

@@ -179,11 +180,12 @@ int16_t WiFiScanClass::scanComplete() {
179180
*/
180181
void WiFiScanClass::scanDelete() {
181182
WiFiGenericClass::clearStatusBits(WIFI_SCAN_DONE_BIT);
183+
WiFiGenericClass::clearStatusBits(WIFI_SCANNING_BIT);
182184
if (WiFiScanClass::_scanResult) {
183185
delete[] reinterpret_cast<wifi_ap_record_t *>(WiFiScanClass::_scanResult);
184186
WiFiScanClass::_scanResult = nullptr;
185-
WiFiScanClass::_scanCount = 0;
186187
}
188+
WiFiScanClass::_scanCount = 0;
187189
}
188190

189191
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.