remove network from activation phase

This commit is contained in:
2018-11-08 13:46:17 +01:00
parent bb81391d00
commit f290ec6197
19 changed files with 138 additions and 66 deletions

View File

@@ -22,14 +22,12 @@ Network* WiFiNet::init() {
return this;
}
int WiFiNet::connect(){
if(config.valid){
WiFi.hostname(config.hostname);
Serial.println("Hostname: " + config.hostname);
if(!connectStation()) {
createAccessPoint();
}
startDNS();
WiFi.hostname(config.hostname);
Serial.println("Hostname: " + config.hostname);
if(!connectStation()) {
createAccessPoint();
}
startDNS();
return 1;
}
@@ -41,6 +39,7 @@ int WiFiNet::connectStation(){
WiFi.begin(config.stationSSID.c_str(), config.stationPassword.c_str());
Serial.println("connect to " + config.stationSSID);
// TODO use tasks
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");