add static ip config for wifi device
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
|
||||
RTC_NOINIT_ATTR char WiFiDevice_reconfdetect[17];
|
||||
|
||||
WifiDevice::WifiDevice(const String& hostname, Preferences* _preferences)
|
||||
: NetworkDevice(hostname)
|
||||
WifiDevice::WifiDevice(const String& hostname, Preferences* _preferences, const IPConfiguration* ipConfiguration)
|
||||
: NetworkDevice(hostname, ipConfiguration)
|
||||
{
|
||||
_startAp = strcmp(WiFiDevice_reconfdetect, "reconfigure_wifi") == 0;
|
||||
|
||||
@@ -69,6 +69,20 @@ void WifiDevice::initialize()
|
||||
_wm.setMenu(wm_menu);
|
||||
_wm.setHostname(_hostname);
|
||||
|
||||
if(!_ipConfiguration->dhcpEnabled())
|
||||
{
|
||||
IPAddress address;
|
||||
address.fromString(_ipConfiguration->ipAddress());
|
||||
IPAddress gateway;
|
||||
gateway.fromString(_ipConfiguration->defaultGateway());
|
||||
IPAddress subnet;
|
||||
subnet.fromString(_ipConfiguration->subnet());
|
||||
IPAddress dns;
|
||||
dns.fromString(_ipConfiguration->dnsServer());
|
||||
|
||||
_wm.setSTAStaticIPConfig(address, gateway, subnet, dns);
|
||||
}
|
||||
|
||||
_wm.setAPCallback(clearRtcInitVar);
|
||||
|
||||
bool res = false;
|
||||
|
||||
Reference in New Issue
Block a user