diff --git a/309/CO_gateway_ascii.c b/309/CO_gateway_ascii.c index ed1a1fd..4e3213a 100644 --- a/309/CO_gateway_ascii.c +++ b/309/CO_gateway_ascii.c @@ -125,6 +125,10 @@ CO_GTWA_log_print(CO_GTWA_t* gtwa, const char* message) { if ((gtwa != NULL) && (message != NULL)) { const char* c; + /* add newline between messages */ + if (CO_fifo_getOccupied(>wa->logFifo) > 0U) { + CO_fifo_putc_ov(>wa->logFifo, '\n'); + } for (c = &message[0]; *c != '\0'; c++) { CO_fifo_putc_ov(>wa->logFifo, (const uint8_t)*c); } @@ -1918,6 +1922,8 @@ CO_GTWA_process(CO_GTWA_t* gtwa, bool_t enable, uint32_t timeDifference_us, uint #if ((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_LOG) != 0 /* print message log */ case CO_GTWA_ST_LOG: { + CO_fifo_putc_ov(>wa->logFifo, '\r'); + CO_fifo_putc_ov(>wa->logFifo, '\n'); do { gtwa->respBufCount = CO_fifo_read(>wa->logFifo, (uint8_t*)gtwa->respBuf, CO_GTWA_RESP_BUF_SIZE, NULL); diff --git a/309/CO_gateway_ascii.h b/309/CO_gateway_ascii.h index 7c3947b..1c1da6d 100644 --- a/309/CO_gateway_ascii.h +++ b/309/CO_gateway_ascii.h @@ -378,6 +378,7 @@ CO_GTWA_write(CO_GTWA_t* gtwa, const char* buf, size_t count) { * This function enables recording of system log messages including CANopen events. Function can be called by * application for recording any message. Message is copied to internal fifo buffer. In case fifo is full, old messages * will be owerwritten. Message log fifo can be read with non-standard command "log". After log is read, it is emptied. + * Message must not contain "\r\n" inside. Newline character '\n' will be added between the messages automatically. * * @param gtwa This object * @param message Null terminated string