kopia lustrzana https://github.com/meshtastic/firmware
Formatting
rodzic
202223236d
commit
ff029ad752
|
@ -24,7 +24,8 @@ SOFTWARE.*/
|
|||
|
||||
#include "DebugConfiguration.h"
|
||||
|
||||
Syslog::Syslog(UDP &client) {
|
||||
Syslog::Syslog(UDP &client)
|
||||
{
|
||||
this->_client = &client;
|
||||
this->_server = NULL;
|
||||
this->_port = 0;
|
||||
|
@ -33,44 +34,52 @@ Syslog::Syslog(UDP &client) {
|
|||
this->_priDefault = LOGLEVEL_KERN;
|
||||
}
|
||||
|
||||
Syslog &Syslog::server(const char* server, uint16_t port) {
|
||||
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) {
|
||||
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) {
|
||||
Syslog &Syslog::deviceHostname(const char *deviceHostname)
|
||||
{
|
||||
this->_deviceHostname = (deviceHostname == NULL) ? SYSLOG_NILVALUE : deviceHostname;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Syslog &Syslog::appName(const char* appName) {
|
||||
Syslog &Syslog::appName(const char *appName)
|
||||
{
|
||||
this->_appName = (appName == NULL) ? SYSLOG_NILVALUE : appName;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Syslog &Syslog::defaultPriority(uint16_t pri) {
|
||||
Syslog &Syslog::defaultPriority(uint16_t pri)
|
||||
{
|
||||
this->_priDefault = pri;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Syslog &Syslog::logMask(uint8_t priMask) {
|
||||
Syslog &Syslog::logMask(uint8_t priMask)
|
||||
{
|
||||
this->_priMask = priMask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Syslog::enable() {
|
||||
void Syslog::enable()
|
||||
{
|
||||
this->_enabled = true;
|
||||
}
|
||||
|
||||
void Syslog::disable() {
|
||||
void Syslog::disable()
|
||||
{
|
||||
this->_enabled = false;
|
||||
}
|
||||
|
||||
|
@ -79,19 +88,23 @@ bool Syslog::isEnabled()
|
|||
return this->_enabled;
|
||||
}
|
||||
|
||||
bool Syslog::log(uint16_t pri, const __FlashStringHelper *message) {
|
||||
bool Syslog::log(uint16_t pri, const __FlashStringHelper *message)
|
||||
{
|
||||
return this->_sendLog(pri, message);
|
||||
}
|
||||
|
||||
bool Syslog::log(uint16_t pri, const String &message) {
|
||||
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) {
|
||||
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) {
|
||||
bool Syslog::vlogf(uint16_t pri, const char *fmt, va_list args)
|
||||
{
|
||||
char *message;
|
||||
size_t initialLen;
|
||||
size_t len;
|
||||
|
@ -115,7 +128,8 @@ bool Syslog::vlogf(uint16_t pri, const char *fmt, va_list args) {
|
|||
return result;
|
||||
}
|
||||
|
||||
bool Syslog::vlogf_P(uint16_t pri, PGM_P fmt_P, va_list args) {
|
||||
bool Syslog::vlogf_P(uint16_t pri, PGM_P fmt_P, va_list args)
|
||||
{
|
||||
char *message;
|
||||
size_t initialLen;
|
||||
size_t len;
|
||||
|
@ -139,8 +153,8 @@ bool Syslog::vlogf_P(uint16_t pri, PGM_P fmt_P, va_list args) {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool Syslog::logf(uint16_t pri, const char *fmt, ...) {
|
||||
bool Syslog::logf(uint16_t pri, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
bool result;
|
||||
|
||||
|
@ -150,7 +164,8 @@ bool Syslog::logf(uint16_t pri, const char *fmt, ...) {
|
|||
return result;
|
||||
}
|
||||
|
||||
bool Syslog::logf_P(uint16_t pri, PGM_P fmt_P, ...) {
|
||||
bool Syslog::logf_P(uint16_t pri, PGM_P fmt_P, ...)
|
||||
{
|
||||
va_list args;
|
||||
bool result;
|
||||
|
||||
|
@ -160,7 +175,8 @@ bool Syslog::logf_P(uint16_t pri, PGM_P fmt_P, ...) {
|
|||
return result;
|
||||
}
|
||||
|
||||
inline bool Syslog::_sendLog(uint16_t pri, const char *message) {
|
||||
inline bool Syslog::_sendLog(uint16_t pri, const char *message)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (!this->_enabled)
|
||||
|
@ -200,7 +216,8 @@ inline bool Syslog::_sendLog(uint16_t pri, const char *message) {
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool Syslog::_sendLog(uint16_t pri, const __FlashStringHelper *message) {
|
||||
inline bool Syslog::_sendLog(uint16_t pri, const __FlashStringHelper *message)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (!this->_enabled)
|
||||
|
@ -236,6 +253,5 @@ inline bool Syslog::_sendLog(uint16_t pri, const __FlashStringHelper *message) {
|
|||
this->_client->print(message);
|
||||
this->_client->endPacket();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
|
@ -108,7 +108,8 @@
|
|||
// Default Bluetooth PIN
|
||||
#define defaultBLEPin 123456
|
||||
|
||||
class Syslog {
|
||||
class Syslog
|
||||
{
|
||||
private:
|
||||
UDP *_client;
|
||||
IPAddress _ip;
|
||||
|
|
|
@ -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>
|
||||
|
@ -143,10 +143,14 @@ bool initEthernet()
|
|||
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();
|
||||
|
|
|
@ -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>
|
||||
|
@ -195,9 +195,7 @@ 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,
|
||||
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);
|
||||
|
||||
/*
|
||||
|
|
Ładowanie…
Reference in New Issue