apply astylerc

This commit is contained in:
technyon
2024-11-23 16:55:59 +01:00
parent a426d955a3
commit 27fa67f9b1
11 changed files with 288 additions and 171 deletions

View File

@@ -126,7 +126,7 @@ void EthernetDevice::initialize()
void EthernetDevice::update()
{
NetworkDevice::update();
if(_checkIpTs != -1 && _checkIpTs < espMillis())
{
if(_ipConfiguration->ipAddress() != ETH.localIP())
@@ -136,7 +136,7 @@ void EthernetDevice::update()
_checkIpTs = espMillis() + 5000;
return;
}
_checkIpTs = -1;
}
}

View File

@@ -25,7 +25,8 @@ void NetworkDevice::init()
_mqttClientSecure->setCertificate(_cert);
_mqttClientSecure->setPrivateKey(_key);
}
} else
}
else
{
Log->println(F("MQTT without TLS."));
_mqttClient = new espMqttClient(espMqttClientTypes::UseInternalTask::NO);
@@ -35,9 +36,18 @@ void NetworkDevice::init()
{
MqttLoggerMode mode;
if(_preferences->getBool(preference_mqtt_log_enabled, false) && _preferences->getBool(preference_webserial_enabled, false)) mode = MqttLoggerMode::MqttAndSerialAndWeb;
else if (_preferences->getBool(preference_webserial_enabled, false)) mode = MqttLoggerMode::SerialAndWeb;
else mode = MqttLoggerMode::MqttAndSerial;
if(_preferences->getBool(preference_mqtt_log_enabled, false) && _preferences->getBool(preference_webserial_enabled, false))
{
mode = MqttLoggerMode::MqttAndSerialAndWeb;
}
else if (_preferences->getBool(preference_webserial_enabled, false))
{
mode = MqttLoggerMode::SerialAndWeb;
}
else
{
mode = MqttLoggerMode::MqttAndSerial;
}
_path = new char[200];
memset(_path, 0, sizeof(_path));

View File

@@ -95,7 +95,7 @@ void WifiDevice::openAP()
WiFi.softAPsetHostname(_hostname.c_str());
delay(500);
WiFi.softAP("NukiHub", "NukiHubESP32");
//if(MDNS.begin(_hostname.c_str())){
// MDNS.addService("http", "tcp", 80);
//}
@@ -112,7 +112,7 @@ bool WifiDevice::connect()
delay(500);
int bestConnection = -1;
if(_preferences->getBool(preference_find_best_rssi, false))
{
for (int i = 0; i < _foundNetworks; i++)
@@ -137,7 +137,7 @@ bool WifiDevice::connect()
}
}
}
if (bestConnection == -1)
{
Log->print("No network found with SSID: ");
@@ -166,24 +166,24 @@ bool WifiDevice::connect()
switch (status)
{
case WL_CONNECTED:
Log->println("WiFi connected");
break;
case WL_NO_SSID_AVAIL:
Log->println("WiFi SSID not available");
break;
case WL_CONNECT_FAILED:
Log->println("WiFi connection failed");
break;
case WL_IDLE_STATUS:
Log->println("WiFi changing status");
break;
case WL_DISCONNECTED:
Log->println("WiFi disconnected");
break;
default:
Log->println("WiFi timeout");
break;
case WL_CONNECTED:
Log->println("WiFi connected");
break;
case WL_NO_SSID_AVAIL:
Log->println("WiFi SSID not available");
break;
case WL_CONNECT_FAILED:
Log->println("WiFi connection failed");
break;
case WL_IDLE_STATUS:
Log->println("WiFi changing status");
break;
case WL_DISCONNECTED:
Log->println("WiFi disconnected");
break;
default:
Log->println("WiFi timeout");
break;
}
if (status != WL_CONNECTED)
@@ -250,7 +250,10 @@ void WifiDevice::onConnected()
void WifiDevice::onDisconnected()
{
if (!_connected) return;
if (!_connected)
{
return;
}
_connected = false;
Log->println("Wi-Fi disconnected");