mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 07:40:58 -08:00
Merge pull request #1006 from justcallmekoko/develop
Wardriving is asynchronous now
This commit is contained in:
@@ -2499,6 +2499,7 @@ void WiFiScan::StopScan(uint8_t scan_mode)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->shutdownBLE();
|
this->shutdownBLE();
|
||||||
|
this->ble_scanning = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4414,21 +4415,36 @@ void WiFiScan::executeWarDrive() {
|
|||||||
bool do_save;
|
bool do_save;
|
||||||
String display_string;
|
String display_string;
|
||||||
|
|
||||||
while (WiFi.scanComplete() == WIFI_SCAN_RUNNING) {
|
/*while (WiFi.scanComplete() == WIFI_SCAN_RUNNING) {
|
||||||
Serial.println(F("Scan running..."));
|
Serial.println(F("Scan running..."));
|
||||||
delay(500);
|
delay(500);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
int scan_status = WiFi.scanComplete();
|
||||||
|
|
||||||
|
if (scan_status == WIFI_SCAN_RUNNING) {
|
||||||
|
delay(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (scan_status == WIFI_SCAN_FAILED) {
|
||||||
|
Serial.println("WiFi scan failed to start. Restarting...");
|
||||||
|
this->wifi_initialized = true;
|
||||||
|
this->shutdownWiFi();
|
||||||
|
this->startWardriverWiFi();
|
||||||
|
this->wifi_initialized = true;
|
||||||
|
delay(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAS_DUAL_BAND
|
/*#ifndef HAS_DUAL_BAND
|
||||||
int n = WiFi.scanNetworks(false, true, false, 110, this->set_channel);
|
int n = WiFi.scanNetworks(false, true, false, 110, this->set_channel);
|
||||||
#else
|
#else
|
||||||
int n = WiFi.scanNetworks(false, true, false, 110);
|
int n = WiFi.scanNetworks(false, true, false, 110);
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
bool do_continue = false;
|
bool do_continue = false;
|
||||||
|
|
||||||
if (n > 0) {
|
if (scan_status > 0) {
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < scan_status; i++) {
|
||||||
do_continue = true;
|
do_continue = true;
|
||||||
display_string = "";
|
display_string = "";
|
||||||
do_save = false;
|
do_save = false;
|
||||||
@@ -4497,14 +4513,17 @@ void WiFiScan::executeWarDrive() {
|
|||||||
buffer_obj.append(wardrive_line);
|
buffer_obj.append(wardrive_line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Free up that memory, you sexy devil
|
||||||
|
WiFi.scanDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAS_DUAL_BAND
|
/*#ifndef HAS_DUAL_BAND
|
||||||
this->channelHop();
|
this->channelHop();
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
// Free up that memory, you sexy devil
|
if (!this->ble_scanning)
|
||||||
WiFi.scanDelete();
|
WiFi.scanNetworks(true, true, false, 80);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -10131,9 +10150,11 @@ void WiFiScan::main(uint32_t currentTime)
|
|||||||
this->ble_scanning = false;
|
this->ble_scanning = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pBLEScan->start(0, scanCompleteCB, false);
|
if (WiFi.scanComplete() != WIFI_SCAN_RUNNING) {
|
||||||
this->ble_scanning = true;
|
pBLEScan->start(0, scanCompleteCB, false);
|
||||||
return;
|
this->ble_scanning = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (currentScanMode == BT_SCAN_FLOCK)
|
if (currentScanMode == BT_SCAN_FLOCK)
|
||||||
|
|||||||
Reference in New Issue
Block a user