[go: nahoru, domu]

Skip to content

Commit

Permalink
fix: static IP config broken on ESP32
Browse files Browse the repository at this point in the history
Closes #93
  • Loading branch information
schw4rzlicht committed Jan 21, 2024
1 parent ebd4cc5 commit 7da64bd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ void connectToWiFi()
{ wifiWebServerStarted = true; });

wifiManager.setHostname(WIFI_HOSTNAME);

#if defined(IP_ADDRESS) && defined(GWY) && defined(SUBNET) && defined(DNS1) && \
defined(DNS2)
auto ip = IPAddress();
ip.fromString(IP_ADDRESS);

auto gwy = IPAddress();
gwy.fromString(GWY);

auto subnet = IPAddress();
subnet.fromString(SUBNET);

auto dns = IPAddress();
dns.fromString(DNS1);

wifiManager.setSTAStaticIPConfig(ip, gwy, subnet, dns);
#endif

wifiManager.autoConnect(WIFI_MANAGER_SSID);

if (MDNS.begin(WIFI_HOSTNAME))
Expand Down

0 comments on commit 7da64bd

Please sign in to comment.