1
0
Fork 0

CO_gateway_ascii: function CO_GTWA_log_print() fixed. "log" inquiry now works.

This commit is contained in:
Janez 2025-08-04 18:01:26 +02:00
parent b6e9107a9a
commit ef9ac3a227
2 changed files with 7 additions and 0 deletions

View file

@ -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(&gtwa->logFifo) > 0U) {
CO_fifo_putc_ov(&gtwa->logFifo, '\n');
}
for (c = &message[0]; *c != '\0'; c++) {
CO_fifo_putc_ov(&gtwa->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(&gtwa->logFifo, '\r');
CO_fifo_putc_ov(&gtwa->logFifo, '\n');
do {
gtwa->respBufCount = CO_fifo_read(&gtwa->logFifo, (uint8_t*)gtwa->respBuf, CO_GTWA_RESP_BUF_SIZE,
NULL);

View file

@ -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