added ability to set custom config for access point

This commit is contained in:
Alex Tudorache
2015-11-10 08:46:38 +02:00
parent 8f38a0fbaf
commit 87911808ab
4 changed files with 41 additions and 12 deletions
+12
View File
@@ -34,6 +34,12 @@ void WiFiManager::begin(char const *apName) {
DEBUG_PRINT("Configuring access point... ");
DEBUG_PRINT(_apName);
//optional soft ip config
if (_ip) {
DEBUG_PRINT("Custom IP/GW/Subnet");
WiFi.softAPConfig(_ip, _gw, _sn);
}
WiFi.softAP(_apName);//TODO: add password option
delay(500); // Without delay I've seen the IP address blank
DEBUG_PRINT("AP IP address: ");
@@ -250,6 +256,12 @@ void WiFiManager::setDebugOutput(boolean debug) {
_debug = debug;
}
void WiFiManager::setAPConfig(IPAddress ip, IPAddress gw, IPAddress sn) {
_ip = ip;
_gw = gw;
_sn = sn;
}
/** Handle root or redirect to captive portal */
void WiFiManager::handleRoot() {