Closed ajpaezm closed 5 years ago
To turn off the WiFi scanning, can I use something like this which I saw as well on main.cpp?
WiFi.mode(WIFI_OFF)
This belongs to the library
...
void set_wifiscan(uint8_t val[]) {
ESP_LOGI(TAG, "Remote command: set WIFI scanner to %s", val[0] ? "on" : "off");
cfg.wifiscan = val[0] ? 1 : 0;
if (cfg.wifiscan)
wifi_sniffer_init();
else {
macs_wifi = 0; // clear WIFI counter
WiFi.mode(WIFI_OFF);
}
}
But it didn't work.
paxcounter does not use the Wifi stack of ardunio-esp32, since this is neither needed nor useful for wifi promiscuous mode, but draws lot of power and RAM. So WiFi.mode() is not needed.
What is your intention, why do you want to switch off wifi scanning?
Thanks for replying @cyberman54!
What is your intention, why do you want to switch off wifi scanning?
My goal with this part is just to be able to control when to scan wifi, when to scan ble, or when to scan both. Just that.
And I didn't see that option in the code. I guess I could set the rssi to -1db, which for practical usages would have the same effect. Unless of course there's a more efficient way of doing so.
RSSI will affect both Wifi an bluetooth, so is not an option. Make a Pull Request to improve this software! That's why it is open source!
@ajpaezm I added this feature, there is a new rcommand 0x17 to remotely switch wifi sniffing on/off. Please try current version in development branch, and report results here. Thanks.
fixed in Master
Hello @cyberman54, reporting results here:
1) When I set WIFICOUNTER to 0 and BLECOUNTER to 1, doesn't send me any errors. So good on that front.
2) But... when I try to use the 0x17 command, regardless if it is for turning it off or on, I get this message:
@ajpaezm if you want to switch on/off WIFI during runtime, you need to set compile option WIFICOUNTER to 1. The runtime setting (rcmd 0x17) will automatically be saved on the board, so after you restart the device wifi will be off if you once set it to off, regardless of compile option WIFICOUNTER.
Hello,
I would like to turn on/off the wifi scanning at will through a LoRaWAN command. I'm not sure if such feature is already written in the code, but if not, I was thinking in this approach (identical to what set_blescan() is in rcommand.cpp script).
Please note that the variable wifiscan has been declared under globals.h and the table object has been updated as well inside rcommand.cpp.
What I'm missing is the method that will disable wifi readings.
Is this something that already exists in the code? If so, how do we enable/disable it?
Also: is it possible for both WIFI and BLE to be enabled at the same time IF two ESP32 boards, which are supported of course, are connected?
Thanks in advance!