This commit is contained in:
proddy
2021-03-30 12:00:16 +02:00

View File

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