mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-03 12:33:53 +00:00
fix nRF52 and linter errors.
This commit is contained in:
parent
104ffe36b2
commit
661894f9f9
@ -128,31 +128,6 @@ bool Syslog::vlogf(uint16_t pri, const char *fmt, va_list args)
|
|||||||
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;
|
|
||||||
|
|
||||||
initialLen = strlen_P(fmt_P);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
delete[] message;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Syslog::logf(uint16_t pri, const char *fmt, ...)
|
bool Syslog::logf(uint16_t pri, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
@ -164,17 +139,6 @@ bool Syslog::logf(uint16_t pri, const char *fmt, ...)
|
|||||||
return result;
|
return 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool Syslog::_sendLog(uint16_t pri, const char *message)
|
inline bool Syslog::_sendLog(uint16_t pri, const char *message)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
@ -108,6 +108,10 @@
|
|||||||
// Default Bluetooth PIN
|
// Default Bluetooth PIN
|
||||||
#define defaultBLEPin 123456
|
#define defaultBLEPin 123456
|
||||||
|
|
||||||
|
#if HAS_ETHERNET
|
||||||
|
#include <RAK13800_W5100S.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class Syslog
|
class Syslog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -125,7 +129,7 @@ class Syslog
|
|||||||
bool _sendLog(uint16_t pri, const __FlashStringHelper *message);
|
bool _sendLog(uint16_t pri, const __FlashStringHelper *message);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Syslog(UDP &client);
|
explicit 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 &server(IPAddress ip, uint16_t port);
|
||||||
@ -143,11 +147,8 @@ class Syslog
|
|||||||
bool log(uint16_t pri, const char *message);
|
bool log(uint16_t pri, const char *message);
|
||||||
|
|
||||||
bool vlogf(uint16_t pri, const char *fmt, va_list args) __attribute__((format(printf, 3, 0)));
|
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(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)));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -2,6 +2,7 @@
|
|||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
#include "concurrency/Periodic.h"
|
#include "concurrency/Periodic.h"
|
||||||
|
#include "main.h"
|
||||||
#include "mesh/api/ethServerAPI.h"
|
#include "mesh/api/ethServerAPI.h"
|
||||||
#include "mqtt/MQTT.h"
|
#include "mqtt/MQTT.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
@ -54,7 +55,7 @@ static int32_t reconnectETH()
|
|||||||
serverAddr = server.c_str();
|
serverAddr = server.c_str();
|
||||||
}
|
}
|
||||||
syslog.server(serverAddr, serverPort);
|
syslog.server(serverAddr, serverPort);
|
||||||
syslog.deviceHostname(WiFi.getHostname());
|
syslog.deviceHostname(getDeviceName());
|
||||||
syslog.appName("Meshtastic");
|
syslog.appName("Meshtastic");
|
||||||
syslog.defaultPriority(LOGLEVEL_USER);
|
syslog.defaultPriority(LOGLEVEL_USER);
|
||||||
syslog.enable();
|
syslog.enable();
|
||||||
|
@ -152,7 +152,7 @@ static void onNetworkConnected()
|
|||||||
serverAddr = server.c_str();
|
serverAddr = server.c_str();
|
||||||
}
|
}
|
||||||
syslog.server(serverAddr, serverPort);
|
syslog.server(serverAddr, serverPort);
|
||||||
syslog.deviceHostname(WiFi.getHostname());
|
syslog.deviceHostname(getDeviceName());
|
||||||
syslog.appName("Meshtastic");
|
syslog.appName("Meshtastic");
|
||||||
syslog.defaultPriority(LOGLEVEL_USER);
|
syslog.defaultPriority(LOGLEVEL_USER);
|
||||||
syslog.enable();
|
syslog.enable();
|
||||||
|
Loading…
Reference in New Issue
Block a user