Обновление
This commit is contained in:
parent
38623c52d2
commit
5d561fd044
|
|
@ -35,6 +35,8 @@ typedef struct {
|
||||||
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;
|
||||||
|
|
||||||
|
osMutexId_t access;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
osThreadId_t id;
|
osThreadId_t id;
|
||||||
uint32_t stack[384];
|
uint32_t stack[384];
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,9 @@ static void LoggerToSerialPort_TimeToString(time_t timestamp, char *strbuf) {
|
||||||
asctime_r(×tampTM, strbuf);
|
asctime_r(×tampTM, strbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoggerToSerialPort_PrintLegend(
|
static uint32_t LoggerToSerialPort_PrintLegend(
|
||||||
tLoggerToSerialPort *env,
|
tLoggerToSerialPort *env,
|
||||||
|
char *outStr[],
|
||||||
char *authorStatic,
|
char *authorStatic,
|
||||||
const uint8_t authorLen,
|
const uint8_t authorLen,
|
||||||
eLoggerLevel loglevel
|
eLoggerLevel loglevel
|
||||||
|
|
@ -113,9 +114,12 @@ static void LoggerToSerialPort_PrintLegend(
|
||||||
if (env->flags)
|
if (env->flags)
|
||||||
vAsciiStringAdd(str, &strLen, ": ", 2);
|
vAsciiStringAdd(str, &strLen, ": ", 2);
|
||||||
|
|
||||||
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) str, strLen, env->timeout);
|
// SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) str, strLen, env->timeout);
|
||||||
|
*outStr = str;
|
||||||
|
|
||||||
env->open = true;
|
env->open = true;
|
||||||
|
|
||||||
|
return strLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoggerToSerialPort_Logging(
|
static void LoggerToSerialPort_Logging(
|
||||||
|
|
@ -136,19 +140,30 @@ static void LoggerToSerialPort_Logging(
|
||||||
// env->timeout = 0;
|
// env->timeout = 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!env->open) {
|
char *outStr = NULL;
|
||||||
LoggerToSerialPort_PrintLegend(env, authorStatic, authorLen, loglevel);
|
uint32_t lenStr;
|
||||||
}
|
|
||||||
|
|
||||||
//выводим сообщение
|
// if (!env->open) {
|
||||||
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) msg, msgLen, env->timeout);
|
lenStr = LoggerToSerialPort_PrintLegend(env, &outStr, authorStatic, authorLen, loglevel);
|
||||||
|
// }
|
||||||
|
|
||||||
if (complete) {
|
if (osMutexAcquire(env->access, env->timeout) == osOK) {
|
||||||
//переводим строку
|
|
||||||
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) "\r\n", 2, env->timeout);
|
//выводим сообщение
|
||||||
env->open = false;
|
if (outStr != NULL) {
|
||||||
} else {
|
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) outStr, lenStr, env->timeout);
|
||||||
env->open = true;
|
}
|
||||||
|
|
||||||
|
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) msg, msgLen, env->timeout);
|
||||||
|
|
||||||
|
if (complete) {
|
||||||
|
//переводим строку
|
||||||
|
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) "\r\n", 2, env->timeout);
|
||||||
|
// env->open = false;
|
||||||
|
} else {
|
||||||
|
// env->open = true;
|
||||||
|
}
|
||||||
|
osMutexRelease(env->access);
|
||||||
}
|
}
|
||||||
|
|
||||||
// env->timeout = timeoutLocal;
|
// env->timeout = timeoutLocal;
|
||||||
|
|
@ -175,6 +190,9 @@ void LoggerToSerialPort_Init(
|
||||||
env->rtc = rtc;
|
env->rtc = rtc;
|
||||||
env->flags = flags;
|
env->flags = flags;
|
||||||
env->timeoutTransmittedLog = timeoutTransmittedLog;
|
env->timeoutTransmittedLog = timeoutTransmittedLog;
|
||||||
|
|
||||||
|
env->access = osMutexNew(NULL);
|
||||||
|
|
||||||
// env->showDate = showDate;
|
// env->showDate = showDate;
|
||||||
// env->showTime = showTime;
|
// env->showTime = showTime;
|
||||||
// env->showLoglevel = showLoglevel;
|
// env->showLoglevel = showLoglevel;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue