New logger & removed old unused files

This commit is contained in:
Martin Bauer
2021-08-10 22:47:47 +02:00
parent 28c85f749c
commit ce12c846f6
18 changed files with 179 additions and 534 deletions

View File

@@ -1,4 +1,5 @@
#include "WifiManager.h"
#include "Logger.h"
void WifiManager::begin(const String &hostname, const String & wifiStaModeName)
{
@@ -21,7 +22,7 @@ void WifiManager::startWifi()
// station mode
WiFi.mode(WIFI_STA);
WiFi.begin(staSSID.c_str(), staPassword.c_str());
Serial.printf("Starting WiFi station mode to ssid %s, hostname %s\n", staSSID.c_str(), hostname_.c_str());
LOG_INFO("Starting WiFi station mode to ssid %s, hostname %s", staSSID.c_str(), hostname_.c_str());
WiFi.setHostname(hostname_.c_str());
int connectCounter = 0;
bool successful = true;
@@ -29,7 +30,7 @@ void WifiManager::startWifi()
while (WiFi.status() != WL_CONNECTED)
{
Serial.printf("WiFI connection problem %d\n", WiFi.status());
LOG_INFO("WiFI connection problem %d", WiFi.status());
WiFi.begin(staSSID.c_str(), staPassword.c_str());
connectCounter += 1;
@@ -51,13 +52,13 @@ void WifiManager::startWifi()
if (apPassword.length() > 0)
{
Serial.printf("Secured AP mode, name %s\n", wifiStaModeName_.c_str());
LOG_INFO("Secured AP mode, name %s\n", wifiStaModeName_.c_str());
WiFi.softAP(wifiStaModeName_.c_str(), apPassword.c_str());
state_ = AP_SECURE;
}
else
{
Serial.printf("Provisioning AP mode, name %s\n", wifiStaModeName_.c_str());
LOG_INFO("Provisioning AP mode, name %s\n", wifiStaModeName_.c_str());
WiFi.softAP(wifiStaModeName_.c_str());
state_ = AP_PROVISIONING;
}
@@ -92,7 +93,7 @@ void WifiManager::iteration()
if (state_ == STA && WiFi.status() != WL_CONNECTED)
{
startWifi();
Serial.println("Connection lost - Restarting WIFI");
LOG_WARNING("Connection lost - Restarting WIFI");
}
}