фиксы до работы с перемычкой вместо оптики
This commit is contained in:
24
OpticalChannelTester/Log.cpp
Normal file
24
OpticalChannelTester/Log.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "Log.h"
|
||||
#include "Config.h"
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace Log {
|
||||
void event(const char *component, const char *message) {
|
||||
if (!SERIAL_ACTION_LOG) return;
|
||||
if (SERIAL_MINIMAL_LOG && strcmp(component, "INPUT") && strcmp(component, "UI") &&
|
||||
strcmp(component, "CONFIG") && strcmp(component, "RESULT")) return;
|
||||
if (SERIAL_LOG_TIMESTAMPS) Serial.printf("[%10lu][%-8s] %s\n", millis(), component, message);
|
||||
else Serial.printf("[%-8s] %s\n", component, message);
|
||||
}
|
||||
|
||||
void printf(const char *component, const char *format, ...) {
|
||||
if (!SERIAL_ACTION_LOG) return;
|
||||
char text[192];
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(text, sizeof(text), format, args);
|
||||
va_end(args);
|
||||
event(component, text);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user