Обновление
This commit is contained in:
parent
93648e8b88
commit
24062a0b57
|
|
@ -10,6 +10,13 @@
|
||||||
#include "RtcIO.h"
|
#include "RtcIO.h"
|
||||||
#include <cmsis_os.h>
|
#include <cmsis_os.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t buf_big1[MAX_LEN_BUF_BIG1_LOG];
|
||||||
|
uint8_t buf_big2[MAX_LEN_BUF_BIG2_LOG];
|
||||||
|
uint8_t buf_small[MAX_LEN_BUF_SMALL_LOG];
|
||||||
|
|
||||||
|
} tLoggerDataBuf;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
tSerialPortIO *serialPortIo_VIRT;
|
tSerialPortIO *serialPortIo_VIRT;
|
||||||
tSerialPortIO *serialPortIo_PHYSIC;
|
tSerialPortIO *serialPortIo_PHYSIC;
|
||||||
|
|
@ -24,7 +31,7 @@ typedef struct {
|
||||||
|
|
||||||
uint8_t buf_LOG[256];
|
uint8_t buf_LOG[256];
|
||||||
|
|
||||||
uint8_t bufLogger[MAX_COUNT_BUF_LOG][MAX_LEN_LOGGER_BUF_LOG + MAX_LEN_PRINTF_BUF_LOG + 32];
|
tLoggerDataBuf bufLogger[MAX_COUNT_BUF_LOG];
|
||||||
uint8_t bufLoggerNames[MAX_COUNT_BUF_LOG][MAX_LEN_BUF_NAME_LOG];
|
uint8_t bufLoggerNames[MAX_COUNT_BUF_LOG][MAX_LEN_BUF_NAME_LOG];
|
||||||
uint8_t countBufLoggerNames;
|
uint8_t countBufLoggerNames;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,20 @@
|
||||||
#include CMSIS_device_header
|
#include CMSIS_device_header
|
||||||
|
|
||||||
static uint8_t *
|
static uint8_t *
|
||||||
getMemLoggerBufLog(tLoggerToSerialPort *env, char *authorStatic, const uint8_t authorLen, uint16_t offset) {
|
getMemLoggerBufLog(tLoggerToSerialPort *env, char *authorStatic, const uint8_t authorLen, LOG_BUF_TYPE logBufType) {
|
||||||
|
|
||||||
for (uint8_t i = 0; i < env->countBufLoggerNames; ++i) {
|
for (uint8_t i = 0; i < env->countBufLoggerNames; ++i) {
|
||||||
if (memcmp(env->bufLoggerNames[i], authorStatic, authorLen) == 0) {
|
if (memcmp(env->bufLoggerNames[i], authorStatic, authorLen) == 0) {
|
||||||
return &env->bufLogger[i][offset];
|
|
||||||
|
if (logBufType == LOG_BUF_SMALL) {
|
||||||
|
return env->bufLogger[i].buf_small;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logBufType == LOG_BUF_BIG1) {
|
||||||
|
return env->bufLogger[i].buf_big1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return env->bufLogger[i].buf_big2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,7 +39,16 @@ getMemLoggerBufLog(tLoggerToSerialPort *env, char *authorStatic, const uint8_t a
|
||||||
memcpy(env->bufLoggerNames[env->countBufLoggerNames], authorStatic, len);
|
memcpy(env->bufLoggerNames[env->countBufLoggerNames], authorStatic, len);
|
||||||
++env->countBufLoggerNames;
|
++env->countBufLoggerNames;
|
||||||
|
|
||||||
return &env->bufLogger[env->countBufLoggerNames - 1][offset];
|
if (logBufType == LOG_BUF_SMALL) {
|
||||||
|
return env->bufLogger[env->countBufLoggerNames - 1].buf_small;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logBufType == LOG_BUF_BIG1) {
|
||||||
|
return env->bufLogger[env->countBufLoggerNames - 1].buf_big1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return env->bufLogger[env->countBufLoggerNames - 1].buf_big2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoggerToSerialPort_TimeToString(time_t timestamp, char *strbuf) {
|
static void LoggerToSerialPort_TimeToString(time_t timestamp, char *strbuf) {
|
||||||
|
|
@ -46,15 +64,14 @@ static void LoggerToSerialPort_PrintLegend(
|
||||||
eLoggerLevel loglevel
|
eLoggerLevel loglevel
|
||||||
) {
|
) {
|
||||||
//char str[128];
|
//char str[128];
|
||||||
char *str = (char *) getMemLoggerBufLog(env, authorStatic, authorLen, 0);
|
char *str = (char *) getMemLoggerBufLog(env, authorStatic, authorLen, LOG_BUF_BIG1);
|
||||||
size_t strLen = 0;
|
size_t strLen = 0;
|
||||||
|
|
||||||
if (env->flags & (SERIAL_LOGGER_SHOW_DATE | SERIAL_LOGGER_SHOW_TIME)) {
|
if (env->flags & (SERIAL_LOGGER_SHOW_DATE | SERIAL_LOGGER_SHOW_TIME)) {
|
||||||
|
|
||||||
time_t timestamp;
|
time_t timestamp;
|
||||||
//char timeString[24];
|
//char timeString[24];
|
||||||
char *timeString = (char *) getMemLoggerBufLog(env, authorStatic, authorLen,
|
char *timeString = (char *) getMemLoggerBufLog(env, authorStatic, authorLen, LOG_BUF_SMALL);
|
||||||
MAX_LEN_LOGGER_BUF_LOG + MAX_LEN_PRINTF_BUF_LOG);
|
|
||||||
|
|
||||||
if (env->rtc) {
|
if (env->rtc) {
|
||||||
RtcGet(env->rtc, ×tamp);
|
RtcGet(env->rtc, ×tamp);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue