fix syslog reboots without eth

This commit is contained in:
MichaelDvP
2021-03-30 11:12:16 +02:00
parent 324a6da0d5
commit d9b577d944

View File

@@ -19,14 +19,10 @@
#include "uuid/syslog.h"
#include <Arduino.h>
#ifdef ARDUINO_ARCH_ESP8266
#include <ESP8266WiFi.h>
#else
#include <WiFi.h>
#endif
#include <WiFiUdp.h>
#include <ETH.h>
#include "../../../src/emsesp.h"
#ifndef UUID_SYSLOG_HAVE_GETTIMEOFDAY
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
@@ -194,7 +190,7 @@ SyslogService::QueuedLogMessage::QueuedLogMessage(unsigned long id, std::shared_
: id_(id)
, content_(std::move(content)) {
// Added by proddy - check for Ethernet too. This assumes the network has already started.
if (time_good_ || WiFi.status() == WL_CONNECTED || ETH.linkUp()) {
if (time_good_ || emsesp::EMSESP::system_.network_connected()) {
#if UUID_SYSLOG_HAVE_GETTIMEOFDAY
if (gettimeofday(&time_, nullptr) != 0) {
time_.tv_sec = (time_t)-1;
@@ -272,10 +268,8 @@ bool SyslogService::can_transmit() {
}
#endif
if (WiFi.status() != WL_CONNECTED) {
if (!ETH.linkUp()) {
return false; // added by proddy. Check Ethernet
}
if (!emsesp::EMSESP::system_.network_connected()) {
return false; // added by proddy. Check Ethernet
}
const uint64_t now = uuid::get_uptime_ms();