1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

correctly handle pass and sizes

This commit is contained in:
wellenvogel
2022-11-15 23:33:49 +01:00
parent 86139fc445
commit c02be797db
5 changed files with 20 additions and 90 deletions

View File

@@ -10,18 +10,6 @@ class GwConfigInterface{
const char * initialValue;
String value;
bool secret=false;
String changedValue;
bool hasChangedValue=false;
void updateValue(String value)
{
hasChangedValue = false;
if (value != this->value)
{
changedValue = value;
hasChangedValue = true;
}
}
public:
GwConfigInterface(const String &name, const char * initialValue, bool secret=false){
this->name=name;

View File

@@ -21,6 +21,7 @@ void GwLog::logString(const char *fmt,...){
va_list args;
va_start(args,fmt);
xSemaphoreTake(locker, portMAX_DELAY);
recordCounter++;
vsnprintf(buffer,bufferSize-1,fmt,args);
buffer[bufferSize-1]=0;
if (! writer) {
@@ -40,6 +41,7 @@ void GwLog::logDebug(int level,const char *fmt,...){
va_list args;
va_start(args,fmt);
xSemaphoreTake(locker, portMAX_DELAY);
recordCounter++;
vsnprintf(buffer,bufferSize-1,fmt,args);
buffer[bufferSize-1]=0;
if (! writer) {

View File

@@ -15,6 +15,7 @@ class GwLog{
int logLevel=1;
GwLogWriter *writer;
SemaphoreHandle_t locker;
long long recordCounter=0;
public:
static const int LOG=1;
static const int ERROR=0;
@@ -29,6 +30,7 @@ class GwLog{
int isActive(int level){return level <= logLevel;};
void flush();
void setLevel(int level){this->logLevel=level;}
long long getRecordCounter(){return recordCounter;}
};
#define LOG_DEBUG(level,...){ if (logger != NULL && logger->isActive(level)) logger->logDebug(level,__VA_ARGS__);}