Reboot lock on Hybrid failure and logging fix

This commit is contained in:
iranl
2025-01-05 12:50:20 +01:00
parent 850f7fcc8a
commit dbb58caf97
19 changed files with 400 additions and 343 deletions

View File

@@ -72,7 +72,7 @@ void EthernetDevice::initialize()
if(ethCriticalFailure)
{
ethCriticalFailure = false;
Log->println(F("Failed to initialize ethernet hardware"));
Log->println(("Failed to initialize ethernet hardware"));
Log->println("Network device has a critical failure, enable fallback to Wi-Fi and reboot.");
wifiFallback = true;
delay(200);
@@ -80,11 +80,11 @@ void EthernetDevice::initialize()
return;
}
Log->println(F("Init Ethernet"));
Log->println(("Init Ethernet"));
if(_useSpi)
{
Log->println(F("Use SPI"));
Log->println(("Use SPI"));
ethCriticalFailure = true;
SPI.begin(_spi_sck, _spi_miso, _spi_mosi);
_hardwareInitialized = ETH.begin(_type, _phy_addr, _cs, _irq, _rst, SPI);
@@ -93,7 +93,7 @@ void EthernetDevice::initialize()
#ifdef CONFIG_IDF_TARGET_ESP32
else
{
Log->println(F("Use RMII"));
Log->println(("Use RMII"));
// Workaround for failing RMII initialization with pioarduino 3.1.0
// Revoke all GPIO's some of them set by init PSRAM in IDF
@@ -118,7 +118,7 @@ void EthernetDevice::initialize()
if(_hardwareInitialized)
{
Log->println(F("Ethernet hardware Initialized"));
Log->println(("Ethernet hardware Initialized"));
wifiFallback = false;
if(_useSpi && !_ipConfiguration->dhcpEnabled())
@@ -133,7 +133,7 @@ void EthernetDevice::initialize()
}
else
{
Log->println(F("Failed to initialize ethernet hardware"));
Log->println(("Failed to initialize ethernet hardware"));
Log->println("Network device has a critical failure, enable fallback to Wi-Fi and reboot.");
wifiFallback = true;
delay(200);
@@ -150,7 +150,7 @@ void EthernetDevice::update()
{
if(_ipConfiguration->ipAddress() != ETH.localIP())
{
Log->println(F("ETH Set static IP"));
Log->println(("ETH Set static IP"));
ETH.config(_ipConfiguration->ipAddress(), _ipConfiguration->defaultGateway(), _ipConfiguration->subnet(), _ipConfiguration->dnsServer());
_checkIpTs = espMillis() + 5000;
return;

View File

@@ -16,20 +16,20 @@ IPConfiguration::IPConfiguration(Preferences *preferences)
_gateway.fromString(_preferences->getString(preference_ip_gateway, ""));
_dnsServer.fromString(_preferences->getString(preference_ip_dns_server, ""));
Log->print(F("IP configuration: "));
Log->print(("IP configuration: "));
if(dhcpEnabled())
{
Log->println(F("DHCP"));
Log->println(("DHCP"));
}
else
{
Log->print(F("IP address: "));
Log->print(("IP address: "));
Log->print(ipAddress());
Log->print(F(", Subnet: "));
Log->print((", Subnet: "));
Log->print(subnet());
Log->print(F(", Gateway: "));
Log->print((", Gateway: "));
Log->print(defaultGateway());
Log->print(F(", DNS: "));
Log->print((", DNS: "));
Log->println(dnsServer());
}
}

View File

@@ -32,7 +32,7 @@ void NetworkDevice::init()
if(ca_cert.length() > 1)
{
_useEncryption = true;
Log->println(F("MQTT over TLS."));
Log->println(("MQTT over TLS."));
_mqttClientSecure = new espMqttClientSecure(espMqttClientTypes::UseInternalTask::NO);
_mqttClientSecure->setCACert(caDest);
@@ -57,7 +57,7 @@ void NetworkDevice::init()
if(cert.length() > 1 && key.length() > 1)
{
Log->println(F("MQTT with client certificate."));
Log->println(("MQTT with client certificate."));
_mqttClientSecure->setCertificate(certDest);
_mqttClientSecure->setPrivateKey(keyDest);
}
@@ -69,7 +69,7 @@ void NetworkDevice::init()
if (!_useEncryption)
{
Log->println(F("MQTT without TLS."));
Log->println(("MQTT without TLS."));
_mqttClient = new espMqttClient(espMqttClientTypes::UseInternalTask::NO);
}

View File

@@ -110,7 +110,7 @@ bool WifiDevice::connect()
if (ssid == WiFi.SSID(i))
{
Log->println(String("Saved SSID ") + ssid + String(" found with RSSI: ") +
String(WiFi.RSSI(i)) + String(F("(")) +
String(WiFi.RSSI(i)) + String(("(")) +
String(constrain((100.0 + WiFi.RSSI(i)) * 2, 0, 100)) +
String(" %) and BSSID: ") + WiFi.BSSIDstr(i) +
String(" and channel: ") + String(WiFi.channel(i)));
@@ -136,7 +136,7 @@ bool WifiDevice::connect()
else
{
Log->println(String("Trying to connect to SSID ") + ssid + String(" found with RSSI: ") +
String(WiFi.RSSI(bestConnection)) + String(F("(")) +
String(WiFi.RSSI(bestConnection)) + String(("(")) +
String(constrain((100.0 + WiFi.RSSI(bestConnection)) * 2, 0, 100)) +
String(" %) and BSSID: ") + WiFi.BSSIDstr(bestConnection) +
String(" and channel: ") + String(WiFi.channel(bestConnection)));
@@ -253,7 +253,7 @@ void WifiDevice::onWifiEvent(const WiFiEvent_t &event, const WiFiEventInfo_t &in
for (int i = 0; i < _foundNetworks; i++)
{
Log->println(String("SSID ") + WiFi.SSID(i) + String(" found with RSSI: ") +
String(WiFi.RSSI(i)) + String(F("(")) +
String(WiFi.RSSI(i)) + String(("(")) +
String(constrain((100.0 + WiFi.RSSI(i)) * 2, 0, 100)) +
String(" %) and BSSID: ") + WiFi.BSSIDstr(i) +
String(" and channel: ") + String(WiFi.channel(i)));