mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Make Wifi channel configurable
This commit is contained in:
parent
224c33ec1d
commit
21eda56c9e
7 changed files with 18 additions and 12 deletions
|
@ -7,6 +7,7 @@
|
|||
bool wifi_enabled = true;
|
||||
bool wifiap_enabled = true;
|
||||
bool mdns_enabled = true; //If true, allows battery monitor te be found by .local address
|
||||
uint16_t wifi_channel = 0;
|
||||
|
||||
std::string custom_hostname; //If not set, the default naming format 'esp32-XXXXXX' will be used
|
||||
std::string ssidAP;
|
||||
|
@ -150,7 +151,9 @@ void connectToWiFi() {
|
|||
if (WiFi.status() != WL_CONNECTED) {
|
||||
lastReconnectAttempt = millis(); // Reset the reconnect attempt timer
|
||||
logging.println("Connecting to Wi-Fi...");
|
||||
|
||||
if (wifi_channel > 14) {
|
||||
wifi_channel = 0;
|
||||
} //prevent users going out of bounds
|
||||
DEBUG_PRINTF("Connecting to Wi-Fi SSID: %s, password: %s, Channel: %d\n", ssid.c_str(), password.c_str(),
|
||||
wifi_channel);
|
||||
WiFi.begin(ssid.c_str(), password.c_str(), wifi_channel);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue