mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-12 00:16:42 +02:00
implemented #318 static IP support
This commit is contained in:
parent
ea991a7723
commit
ca8142e781
7 changed files with 96 additions and 2 deletions
|
@ -141,6 +141,14 @@ bool ahoywifi::setupStation(uint32_t timeout) {
|
|||
}
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
if(mConfig->staticIp.ip[0] != 0) {
|
||||
IPAddress ip(mConfig->staticIp.ip);
|
||||
IPAddress mask(mConfig->staticIp.mask);
|
||||
IPAddress dns(mConfig->staticIp.dns);
|
||||
IPAddress gateway(mConfig->staticIp.gateway);
|
||||
if(!WiFi.config(ip, gateway, mask, dns))
|
||||
DPRINTLN(DBG_ERROR, F("failed to set static IP!"));
|
||||
}
|
||||
WiFi.begin(mSysCfg->stationSsid, mSysCfg->stationPwd);
|
||||
if(String(mSysCfg->deviceName) != "")
|
||||
WiFi.hostname(mSysCfg->deviceName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue