pull/2168/head
Ben Meadors 2023-01-18 15:37:23 -06:00
rodzic 202223236d
commit ff029ad752
4 zmienionych plików z 251 dodań i 232 usunięć

Wyświetl plik

@ -24,218 +24,234 @@ SOFTWARE.*/
#include "DebugConfiguration.h"
Syslog::Syslog(UDP &client) {
this->_client = &client;
this->_server = NULL;
this->_port = 0;
this->_deviceHostname = SYSLOG_NILVALUE;
this->_appName = SYSLOG_NILVALUE;
this->_priDefault = LOGLEVEL_KERN;
Syslog::Syslog(UDP &client)
{
this->_client = &client;
this->_server = NULL;
this->_port = 0;
this->_deviceHostname = SYSLOG_NILVALUE;
this->_appName = SYSLOG_NILVALUE;
this->_priDefault = LOGLEVEL_KERN;
}
Syslog &Syslog::server(const char* server, uint16_t port) {
this->_server = server;
this->_port = port;
return *this;
Syslog &Syslog::server(const char *server, uint16_t port)
{
this->_server = server;
this->_port = port;
return *this;
}
Syslog &Syslog::server(IPAddress ip, uint16_t port) {
this->_ip = ip;
this->_server = NULL;
this->_port = port;
return *this;
Syslog &Syslog::server(IPAddress ip, uint16_t port)
{
this->_ip = ip;
this->_server = NULL;
this->_port = port;
return *this;
}
Syslog &Syslog::deviceHostname(const char* deviceHostname) {
this->_deviceHostname = (deviceHostname == NULL) ? SYSLOG_NILVALUE : deviceHostname;
return *this;
Syslog &Syslog::deviceHostname(const char *deviceHostname)
{
this->_deviceHostname = (deviceHostname == NULL) ? SYSLOG_NILVALUE : deviceHostname;
return *this;
}
Syslog &Syslog::appName(const char* appName) {
this->_appName = (appName == NULL) ? SYSLOG_NILVALUE : appName;
return *this;
Syslog &Syslog::appName(const char *appName)
{
this->_appName = (appName == NULL) ? SYSLOG_NILVALUE : appName;
return *this;
}
Syslog &Syslog::defaultPriority(uint16_t pri) {
this->_priDefault = pri;
return *this;
Syslog &Syslog::defaultPriority(uint16_t pri)
{
this->_priDefault = pri;
return *this;
}
Syslog &Syslog::logMask(uint8_t priMask) {
this->_priMask = priMask;
return *this;
Syslog &Syslog::logMask(uint8_t priMask)
{
this->_priMask = priMask;
return *this;
}
void Syslog::enable() {
this->_enabled = true;
void Syslog::enable()
{
this->_enabled = true;
}
void Syslog::disable() {
this->_enabled = false;
void Syslog::disable()
{
this->_enabled = false;
}
bool Syslog::isEnabled()
{
return this->_enabled;
return this->_enabled;
}
bool Syslog::log(uint16_t pri, const __FlashStringHelper *message) {
return this->_sendLog(pri, message);
bool Syslog::log(uint16_t pri, const __FlashStringHelper *message)
{
return this->_sendLog(pri, message);
}
bool Syslog::log(uint16_t pri, const String &message) {
return this->_sendLog(pri, message.c_str());
bool Syslog::log(uint16_t pri, const String &message)
{
return this->_sendLog(pri, message.c_str());
}
bool Syslog::log(uint16_t pri, const char *message) {
return this->_sendLog(pri, message);
bool Syslog::log(uint16_t pri, const char *message)
{
return this->_sendLog(pri, message);
}
bool Syslog::vlogf(uint16_t pri, const char *fmt, va_list args) {
char *message;
size_t initialLen;
size_t len;
bool result;
bool Syslog::vlogf(uint16_t pri, const char *fmt, va_list args)
{
char *message;
size_t initialLen;
size_t len;
bool result;
initialLen = strlen(fmt);
initialLen = strlen(fmt);
message = new char[initialLen + 1];
message = new char[initialLen + 1];
len = vsnprintf(message, initialLen + 1, fmt, args);
if (len > initialLen) {
delete[] message;
message = new char[len + 1];
vsnprintf(message, len + 1, fmt, args);
}
result = this->_sendLog(pri, message);
len = vsnprintf(message, initialLen + 1, fmt, args);
if (len > initialLen) {
delete[] message;
message = new char[len + 1];
vsnprintf(message, len + 1, fmt, args);
}
result = this->_sendLog(pri, message);
delete[] message;
return result;
return result;
}
bool Syslog::vlogf_P(uint16_t pri, PGM_P fmt_P, va_list args) {
char *message;
size_t initialLen;
size_t len;
bool result;
bool Syslog::vlogf_P(uint16_t pri, PGM_P fmt_P, va_list args)
{
char *message;
size_t initialLen;
size_t len;
bool result;
initialLen = strlen_P(fmt_P);
initialLen = strlen_P(fmt_P);
message = new char[initialLen + 1];
message = new char[initialLen + 1];
len = vsnprintf_P(message, initialLen + 1, fmt_P, args);
if (len > initialLen) {
delete[] message;
message = new char[len + 1];
vsnprintf(message, len + 1, fmt_P, args);
}
result = this->_sendLog(pri, message);
len = vsnprintf_P(message, initialLen + 1, fmt_P, args);
if (len > initialLen) {
delete[] message;
message = new char[len + 1];
vsnprintf(message, len + 1, fmt_P, args);
}
result = this->_sendLog(pri, message);
delete[] message;
return result;
return result;
}
bool Syslog::logf(uint16_t pri, const char *fmt, ...)
{
va_list args;
bool result;
bool Syslog::logf(uint16_t pri, const char *fmt, ...) {
va_list args;
bool result;
va_start(args, fmt);
result = this->vlogf(pri, fmt, args);
va_end(args);
return result;
va_start(args, fmt);
result = this->vlogf(pri, fmt, args);
va_end(args);
return result;
}
bool Syslog::logf_P(uint16_t pri, PGM_P fmt_P, ...) {
va_list args;
bool result;
bool Syslog::logf_P(uint16_t pri, PGM_P fmt_P, ...)
{
va_list args;
bool result;
va_start(args, fmt_P);
result = this->vlogf_P(pri, fmt_P, args);
va_end(args);
return result;
va_start(args, fmt_P);
result = this->vlogf_P(pri, fmt_P, args);
va_end(args);
return result;
}
inline bool Syslog::_sendLog(uint16_t pri, const char *message) {
int result;
inline bool Syslog::_sendLog(uint16_t pri, const char *message)
{
int result;
if (!this->_enabled)
return false;
if (!this->_enabled)
return false;
if ((this->_server == NULL && this->_ip == INADDR_NONE) || this->_port == 0)
return false;
if ((this->_server == NULL && this->_ip == INADDR_NONE) || this->_port == 0)
return false;
// Check priority against priMask values.
if ((LOG_MASK(LOG_PRI(pri)) & this->_priMask) == 0)
return true;
// Set default facility if none specified.
if ((pri & LOG_FACMASK) == 0)
pri = LOG_MAKEPRI(LOG_FAC(this->_priDefault), pri);
if (this->_server != NULL) {
result = this->_client->beginPacket(this->_server, this->_port);
} else {
result = this->_client->beginPacket(this->_ip, this->_port);
}
if (result != 1)
return false;
this->_client->print('<');
this->_client->print(pri);
this->_client->print(F(">1 - "));
this->_client->print(this->_deviceHostname);
this->_client->print(' ');
this->_client->print(this->_appName);
this->_client->print(F(" - - - \xEF\xBB\xBF"));
this->_client->print(F("[0]: "));
this->_client->print(message);
this->_client->endPacket();
// Check priority against priMask values.
if ((LOG_MASK(LOG_PRI(pri)) & this->_priMask) == 0)
return true;
// Set default facility if none specified.
if ((pri & LOG_FACMASK) == 0)
pri = LOG_MAKEPRI(LOG_FAC(this->_priDefault), pri);
if (this->_server != NULL) {
result = this->_client->beginPacket(this->_server, this->_port);
} else {
result = this->_client->beginPacket(this->_ip, this->_port);
}
if (result != 1)
return false;
this->_client->print('<');
this->_client->print(pri);
this->_client->print(F(">1 - "));
this->_client->print(this->_deviceHostname);
this->_client->print(' ');
this->_client->print(this->_appName);
this->_client->print(F(" - - - \xEF\xBB\xBF"));
this->_client->print(F("[0]: "));
this->_client->print(message);
this->_client->endPacket();
return true;
}
inline bool Syslog::_sendLog(uint16_t pri, const __FlashStringHelper *message) {
int result;
inline bool Syslog::_sendLog(uint16_t pri, const __FlashStringHelper *message)
{
int result;
if (!this->_enabled)
return false;
if (!this->_enabled)
return false;
if ((this->_server == NULL && this->_ip == INADDR_NONE) || this->_port == 0)
return false;
if ((this->_server == NULL && this->_ip == INADDR_NONE) || this->_port == 0)
return false;
// Check priority against priMask values.
if ((LOG_MASK(LOG_PRI(pri)) & this->_priMask) == 0)
return true;
// Set default facility if none specified.
if ((pri & LOG_FACMASK) == 0)
pri = LOG_MAKEPRI(LOG_FAC(this->_priDefault), pri);
if (this->_server != NULL) {
result = this->_client->beginPacket(this->_server, this->_port);
} else {
result = this->_client->beginPacket(this->_ip, this->_port);
}
if (result != 1)
return false;
this->_client->print('<');
this->_client->print(pri);
this->_client->print(F(">1 - "));
this->_client->print(this->_deviceHostname);
this->_client->print(' ');
this->_client->print(this->_appName);
this->_client->print(F(" - - - \xEF\xBB\xBF"));
this->_client->print(message);
this->_client->endPacket();
// Check priority against priMask values.
if ((LOG_MASK(LOG_PRI(pri)) & this->_priMask) == 0)
return true;
// Set default facility if none specified.
if ((pri & LOG_FACMASK) == 0)
pri = LOG_MAKEPRI(LOG_FAC(this->_priDefault), pri);
if (this->_server != NULL) {
result = this->_client->beginPacket(this->_server, this->_port);
} else {
result = this->_client->beginPacket(this->_ip, this->_port);
}
if (result != 1)
return false;
this->_client->print('<');
this->_client->print(pri);
this->_client->print(F(">1 - "));
this->_client->print(this->_deviceHostname);
this->_client->print(' ');
this->_client->print(this->_appName);
this->_client->print(F(" - - - \xEF\xBB\xBF"));
this->_client->print(message);
this->_client->endPacket();
return true;
}

Wyświetl plik

@ -1,5 +1,5 @@
#ifndef SYSLOG_H
#define SYSLOG_H
#define SYSLOG_H
// DEBUG LED
#ifndef LED_INVERTED
@ -17,10 +17,10 @@
#endif
#define MESHTASTIC_LOG_LEVEL_DEBUG "DEBUG"
#define MESHTASTIC_LOG_LEVEL_INFO "INFO "
#define MESHTASTIC_LOG_LEVEL_WARN "WARN "
#define MESHTASTIC_LOG_LEVEL_INFO "INFO "
#define MESHTASTIC_LOG_LEVEL_WARN "WARN "
#define MESHTASTIC_LOG_LEVEL_ERROR "ERROR"
#define MESHTASTIC_LOG_LEVEL_CRIT "CRIT "
#define MESHTASTIC_LOG_LEVEL_CRIT "CRIT "
#define MESHTASTIC_LOG_LEVEL_TRACE "TRACE"
#include "SerialConsole.h"
@ -54,49 +54,49 @@
#define SYSLOG_NILVALUE "-"
#define SYSLOG_CRIT 2 /* critical conditions */
#define SYSLOG_ERR 3 /* error conditions */
#define SYSLOG_WARN 4 /* warning conditions */
#define SYSLOG_INFO 6 /* informational */
#define SYSLOG_CRIT 2 /* critical conditions */
#define SYSLOG_ERR 3 /* error conditions */
#define SYSLOG_WARN 4 /* warning conditions */
#define SYSLOG_INFO 6 /* informational */
#define SYSLOG_DEBUG 7 /* debug-level messages */
// trace does not go out to syslog (yet?)
#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
/* extract priority */
#define LOG_PRI(p) ((p) & LOG_PRIMASK)
#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
/* extract priority */
#define LOG_PRI(p) ((p)&LOG_PRIMASK)
#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
/* facility codes */
#define LOGLEVEL_KERN (0<<3) /* kernel messages */
#define LOGLEVEL_USER (1<<3) /* random user-level messages */
#define LOGLEVEL_MAIL (2<<3) /* mail system */
#define LOGLEVEL_DAEMON (3<<3) /* system daemons */
#define LOGLEVEL_AUTH (4<<3) /* security/authorization messages */
#define LOGLEVEL_SYSLOG (5<<3) /* messages generated internally by syslogd */
#define LOGLEVEL_LPR (6<<3) /* line printer subsystem */
#define LOGLEVEL_NEWS (7<<3) /* network news subsystem */
#define LOGLEVEL_UUCP (8<<3) /* UUCP subsystem */
#define LOGLEVEL_CRON (9<<3) /* clock daemon */
#define LOGLEVEL_AUTHPRIV (10<<3) /* security/authorization messages (private) */
#define LOGLEVEL_FTP (11<<3) /* ftp daemon */
#define LOGLEVEL_KERN (0 << 3) /* kernel messages */
#define LOGLEVEL_USER (1 << 3) /* random user-level messages */
#define LOGLEVEL_MAIL (2 << 3) /* mail system */
#define LOGLEVEL_DAEMON (3 << 3) /* system daemons */
#define LOGLEVEL_AUTH (4 << 3) /* security/authorization messages */
#define LOGLEVEL_SYSLOG (5 << 3) /* messages generated internally by syslogd */
#define LOGLEVEL_LPR (6 << 3) /* line printer subsystem */
#define LOGLEVEL_NEWS (7 << 3) /* network news subsystem */
#define LOGLEVEL_UUCP (8 << 3) /* UUCP subsystem */
#define LOGLEVEL_CRON (9 << 3) /* clock daemon */
#define LOGLEVEL_AUTHPRIV (10 << 3) /* security/authorization messages (private) */
#define LOGLEVEL_FTP (11 << 3) /* ftp daemon */
/* other codes through 15 reserved for system use */
#define LOGLEVEL_LOCAL0 (16<<3) /* reserved for local use */
#define LOGLEVEL_LOCAL1 (17<<3) /* reserved for local use */
#define LOGLEVEL_LOCAL2 (18<<3) /* reserved for local use */
#define LOGLEVEL_LOCAL3 (19<<3) /* reserved for local use */
#define LOGLEVEL_LOCAL4 (20<<3) /* reserved for local use */
#define LOGLEVEL_LOCAL5 (21<<3) /* reserved for local use */
#define LOGLEVEL_LOCAL6 (22<<3) /* reserved for local use */
#define LOGLEVEL_LOCAL7 (23<<3) /* reserved for local use */
#define LOGLEVEL_LOCAL0 (16 << 3) /* reserved for local use */
#define LOGLEVEL_LOCAL1 (17 << 3) /* reserved for local use */
#define LOGLEVEL_LOCAL2 (18 << 3) /* reserved for local use */
#define LOGLEVEL_LOCAL3 (19 << 3) /* reserved for local use */
#define LOGLEVEL_LOCAL4 (20 << 3) /* reserved for local use */
#define LOGLEVEL_LOCAL5 (21 << 3) /* reserved for local use */
#define LOGLEVEL_LOCAL6 (22 << 3) /* reserved for local use */
#define LOGLEVEL_LOCAL7 (23 << 3) /* reserved for local use */
#define LOG_NFACILITIES 24 /* current number of facilities */
#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
/* facility of pri */
#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
#define LOG_NFACILITIES 24 /* current number of facilities */
#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
/* facility of pri */
#define LOG_FAC(p) (((p)&LOG_FACMASK) >> 3)
#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
#define LOG_UPTO(pri) ((1 << ((pri) + 1)) - 1) /* all priorities through pri */
// -----------------------------------------------------------------------------
// AXP192 (Rev1-specific options)
@ -108,14 +108,15 @@
// Default Bluetooth PIN
#define defaultBLEPin 123456
class Syslog {
class Syslog
{
private:
UDP* _client;
UDP *_client;
IPAddress _ip;
const char* _server;
const char *_server;
uint16_t _port;
const char* _deviceHostname;
const char* _appName;
const char *_deviceHostname;
const char *_appName;
uint16_t _priDefault;
uint8_t _priMask = 0xff;
bool _enabled = false;
@ -126,10 +127,10 @@ class Syslog {
public:
Syslog(UDP &client);
Syslog &server(const char* server, uint16_t port);
Syslog &server(const char *server, uint16_t port);
Syslog &server(IPAddress ip, uint16_t port);
Syslog &deviceHostname(const char* deviceHostname);
Syslog &appName(const char* appName);
Syslog &deviceHostname(const char *deviceHostname);
Syslog &appName(const char *appName);
Syslog &defaultPriority(uint16_t pri = LOGLEVEL_KERN);
Syslog &logMask(uint8_t priMask);
@ -143,7 +144,7 @@ class Syslog {
bool vlogf(uint16_t pri, const char *fmt, va_list args) __attribute__((format(printf, 3, 0)));
bool vlogf_P(uint16_t pri, PGM_P fmt_P, va_list args) __attribute__((format(printf, 3, 0)));
bool logf(uint16_t pri, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
bool logf_P(uint16_t pri, PGM_P fmt_P, ...) __attribute__((format(printf, 3, 4)));

Wyświetl plik

@ -2,11 +2,11 @@
#include "NodeDB.h"
#include "RTC.h"
#include "concurrency/Periodic.h"
#include <SPI.h>
#include <RAK13800_W5100S.h>
#include "target_specific.h"
#include "mesh/api/ethServerAPI.h"
#include "mqtt/MQTT.h"
#include "target_specific.h"
#include <RAK13800_W5100S.h>
#include <SPI.h>
#ifndef DISABLE_NTP
#include <NTPClient.h>
@ -38,9 +38,9 @@ static int32_t reconnectETH()
LOG_INFO("Starting NTP time client\n");
timeClient.begin();
timeClient.setUpdateInterval(60 * 60); // Update once an hour
#endif
#endif
if(config.network.rsyslog_server[0]) {
if (config.network.rsyslog_server[0]) {
LOG_INFO("Starting Syslog client\n");
// Defaults
int serverPort = 514;
@ -74,7 +74,7 @@ static int32_t reconnectETH()
#ifndef DISABLE_NTP
if (isEthernetAvailable() && (ntp_renew < millis())) {
LOG_INFO("Updating NTP time from %s\n", config.network.ntp_server);
if (timeClient.update()) {
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n");
@ -104,12 +104,12 @@ bool initEthernet()
#ifdef PIN_ETHERNET_RESET
pinMode(PIN_ETHERNET_RESET, OUTPUT);
digitalWrite(PIN_ETHERNET_RESET, LOW); // Reset Time.
digitalWrite(PIN_ETHERNET_RESET, LOW); // Reset Time.
delay(100);
digitalWrite(PIN_ETHERNET_RESET, HIGH); // Reset Time.
digitalWrite(PIN_ETHERNET_RESET, HIGH); // Reset Time.
#endif
Ethernet.init( ETH_SPI_PORT, PIN_ETHERNET_SS );
Ethernet.init(ETH_SPI_PORT, PIN_ETHERNET_SS);
uint8_t mac[6];
@ -118,7 +118,7 @@ bool initEthernet()
// createSSLCert();
getMacAddr(mac); // FIXME use the BLE MAC for now...
mac[0] &= 0xfe; // Make sure this is not a multicast MAC
mac[0] &= 0xfe; // Make sure this is not a multicast MAC
if (config.network.address_mode == Config_NetworkConfig_AddressMode_DHCP) {
LOG_INFO("starting Ethernet DHCP\n");
@ -138,15 +138,19 @@ bool initEthernet()
} else if (Ethernet.linkStatus() == LinkOFF) {
LOG_ERROR("Ethernet cable is not connected.\n");
return false;
} else{
} else {
LOG_ERROR("Unknown Ethernet error.\n");
return false;
}
} else {
LOG_INFO("Local IP %u.%u.%u.%u\n",Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
LOG_INFO("Subnet Mask %u.%u.%u.%u\n",Ethernet.subnetMask()[0], Ethernet.subnetMask()[1], Ethernet.subnetMask()[2], Ethernet.subnetMask()[3]);
LOG_INFO("Gateway IP %u.%u.%u.%u\n",Ethernet.gatewayIP()[0], Ethernet.gatewayIP()[1], Ethernet.gatewayIP()[2], Ethernet.gatewayIP()[3]);
LOG_INFO("DNS Server IP %u.%u.%u.%u\n",Ethernet.dnsServerIP()[0], Ethernet.dnsServerIP()[1], Ethernet.dnsServerIP()[2], Ethernet.dnsServerIP()[3]);
LOG_INFO("Local IP %u.%u.%u.%u\n", Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2],
Ethernet.localIP()[3]);
LOG_INFO("Subnet Mask %u.%u.%u.%u\n", Ethernet.subnetMask()[0], Ethernet.subnetMask()[1], Ethernet.subnetMask()[2],
Ethernet.subnetMask()[3]);
LOG_INFO("Gateway IP %u.%u.%u.%u\n", Ethernet.gatewayIP()[0], Ethernet.gatewayIP()[1], Ethernet.gatewayIP()[2],
Ethernet.gatewayIP()[3]);
LOG_INFO("DNS Server IP %u.%u.%u.%u\n", Ethernet.dnsServerIP()[0], Ethernet.dnsServerIP()[1],
Ethernet.dnsServerIP()[2], Ethernet.dnsServerIP()[3]);
}
ethEvent = new Periodic("ethConnect", reconnectETH);
@ -159,7 +163,8 @@ bool initEthernet()
}
}
bool isEthernetAvailable() {
bool isEthernetAvailable()
{
if (!config.network.eth_enabled) {
syslog.disable();

Wyświetl plik

@ -1,17 +1,17 @@
#include "mesh/http/WiFiAPClient.h"
#include "NodeDB.h"
#include "RTC.h"
#include "concurrency/Periodic.h"
#include "mesh/http/WiFiAPClient.h"
#include "configuration.h"
#include "main.h"
#include "mesh/http/WebServer.h"
#include "mesh/api/WiFiServerAPI.h"
#include "mesh/http/WebServer.h"
#include "mqtt/MQTT.h"
#include "target_specific.h"
#include <ESPmDNS.h>
#include <esp_wifi.h>
#include <WiFi.h>
#include <WiFiUdp.h>
#include <esp_wifi.h>
#ifndef DISABLE_NTP
#include <NTPClient.h>
@ -50,7 +50,7 @@ static int32_t reconnectWiFi()
const char *wifiPsw = config.network.wifi_psk;
if (config.network.wifi_enabled && needReconnect) {
if (!*wifiPsw) // Treat empty password as no password
wifiPsw = NULL;
@ -58,7 +58,7 @@ static int32_t reconnectWiFi()
// Make sure we clear old connection credentials
WiFi.disconnect(false, true);
LOG_INFO("Reconnecting to WiFi access point %s\n",wifiName);
LOG_INFO("Reconnecting to WiFi access point %s\n", wifiName);
delay(5000);
@ -69,7 +69,7 @@ static int32_t reconnectWiFi()
#ifndef DISABLE_NTP
if (WiFi.isConnected() && (((millis() - lastrun_ntp) > 43200000) || (lastrun_ntp == 0))) { // every 12 hours
LOG_DEBUG("Updating NTP time from %s\n",config.network.ntp_server);
LOG_DEBUG("Updating NTP time from %s\n", config.network.ntp_server);
if (timeClient.update()) {
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n");
@ -138,7 +138,7 @@ static void onNetworkConnected()
timeClient.setUpdateInterval(60 * 60); // Update once an hour
#endif
if(config.network.rsyslog_server[0]) {
if (config.network.rsyslog_server[0]) {
LOG_INFO("Starting Syslog client\n");
// Defaults
int serverPort = 514;
@ -195,10 +195,8 @@ bool initWifi()
WiFi.setAutoReconnect(true);
WiFi.setSleep(false);
if (config.network.address_mode == Config_NetworkConfig_AddressMode_STATIC && config.network.ipv4_config.ip != 0) {
WiFi.config(config.network.ipv4_config.ip,
config.network.ipv4_config.gateway,
config.network.ipv4_config.subnet,
config.network.ipv4_config.dns,
WiFi.config(config.network.ipv4_config.ip, config.network.ipv4_config.gateway, config.network.ipv4_config.subnet,
config.network.ipv4_config.dns,
config.network.ipv4_config.dns); // Wifi wants two DNS servers... set both to the same value
}
@ -207,7 +205,6 @@ bool initWifi()
WiFi.onEvent(
[](WiFiEvent_t event, WiFiEventInfo_t info) {
LOG_WARN("WiFi lost connection. Reason: %d\n", info.wifi_sta_disconnected.reason);
/*