mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
syslog also works when Ethernet connected
This commit is contained in:
@@ -26,6 +26,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
|
|
||||||
|
#include <ETH.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)
|
||||||
// time() does not return UTC on the ESP8266: https://github.com/esp8266/Arduino/issues/4637
|
// time() does not return UTC on the ESP8266: https://github.com/esp8266/Arduino/issues/4637
|
||||||
@@ -191,7 +193,8 @@ void SyslogService::mark_interval(unsigned long interval) {
|
|||||||
SyslogService::QueuedLogMessage::QueuedLogMessage(unsigned long id, std::shared_ptr<uuid::log::Message> && content)
|
SyslogService::QueuedLogMessage::QueuedLogMessage(unsigned long id, std::shared_ptr<uuid::log::Message> && content)
|
||||||
: id_(id)
|
: id_(id)
|
||||||
, content_(std::move(content)) {
|
, content_(std::move(content)) {
|
||||||
if (time_good_ || WiFi.status() == WL_CONNECTED) {
|
// Added by proddy - check Ethernet up also
|
||||||
|
if (time_good_ || WiFi.status() == WL_CONNECTED || ETH.linkUp()) {
|
||||||
#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;
|
||||||
@@ -270,7 +273,9 @@ bool SyslogService::can_transmit() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (WiFi.status() != WL_CONNECTED) {
|
if (WiFi.status() != WL_CONNECTED) {
|
||||||
return false;
|
if (!ETH.linkUp()) {
|
||||||
|
return false; // added by proddy. Check Ethernet
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t now = uuid::get_uptime_ms();
|
const uint64_t now = uuid::get_uptime_ms();
|
||||||
|
|||||||
Reference in New Issue
Block a user