mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 10:42:49 +00:00
Simple UDP calls, if wired up a fair bit of this can go again.
this is preliminary work
This commit is contained in:
@@ -17,6 +17,9 @@ NTPClient timeClient(ntpUDP, config.network.ntp_server);
|
||||
uint32_t ntp_renew = 0;
|
||||
#endif
|
||||
|
||||
EthernetUDP syslogClient;
|
||||
Syslog syslog(syslogClient);
|
||||
|
||||
bool ethStartupComplete = 0;
|
||||
|
||||
using namespace concurrency;
|
||||
@@ -36,6 +39,27 @@ static int32_t reconnectETH()
|
||||
timeClient.begin();
|
||||
timeClient.setUpdateInterval(60 * 60); // Update once an hour
|
||||
#endif
|
||||
|
||||
if(config.network.rsyslog_server[0]) {
|
||||
LOG_INFO("Starting Syslog client\n");
|
||||
// Defaults
|
||||
int serverPort = 514;
|
||||
const char *serverAddr = moduleConfig.mqtt.address;
|
||||
String server = String(serverAddr);
|
||||
int delimIndex = server.indexOf(':');
|
||||
if (delimIndex > 0) {
|
||||
String port = server.substring(delimIndex + 1, server.length());
|
||||
server[delimIndex] = 0;
|
||||
serverPort = port.toInt();
|
||||
serverAddr = server.c_str();
|
||||
}
|
||||
syslog.server(serverAddr, serverPort);
|
||||
syslog.deviceHostname(WiFi.getHostname());
|
||||
syslog.appName("Meshtastic");
|
||||
syslog.defaultPriority(LOGLEVEL_USER);
|
||||
syslog.enable();
|
||||
}
|
||||
|
||||
// initWebServer();
|
||||
initApiServer();
|
||||
|
||||
@@ -138,10 +162,13 @@ bool initEthernet()
|
||||
bool isEthernetAvailable() {
|
||||
|
||||
if (!config.network.eth_enabled) {
|
||||
syslog.disable();
|
||||
return false;
|
||||
} else if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
||||
syslog.disable();
|
||||
return false;
|
||||
} else if (Ethernet.linkStatus() == LinkOFF) {
|
||||
syslog.disable();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user