Skip to content

Commit

Permalink
update document iaw current implementation (#9266)
Browse files Browse the repository at this point in the history
  • Loading branch information
stronnag authored Aug 28, 2023
1 parent 029ae30 commit dc3e955
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/development/serial_printf_debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ If the CLI `log_topics` is non-zero, then all topics matching the mask will be d

A set of macros `LOG_ERROR()` (log error) through `LOG_DEBUG()` (log debug) may be used, subject to compile time log level constraints. These provide `printf` style logging for a given topic.

Note that the `topic` is specified without the `LOG_TOPIC_` prefix:

```
// LOG_DEBUG(topic, fmt, ...)
LOG_DEBUG(LOG_TOPIC_SYSTEM, "This is %s topic debug message, value %d", "system", 42);
LOG_DEBUG(SYSTEM, "This is %s topic debug message, value %d", "system", 42);
```

It is also possible to dump a hex representation of arbitrary data, using functions named variously `LOG_BUFFER_` (`ERROR`) and `LOG_BUF_` (anything else, alas) e.g.:
Expand All @@ -89,7 +91,7 @@ It is also possible to dump a hex representation of arbitrary data, using funct
struct {...} tstruct;
...
LOG_BUF_DEBUG(LOG_TOPIC_TEMPERATURE, &tstruct, sizeof(tstruct));
LOG_BUF_DEBUG(TEMPERATURE, &tstruct, sizeof(tstruct));
```

## Output Support
Expand All @@ -104,7 +106,7 @@ Log messages are transmitted through the `FUNCTION_LOG` serial port as MSP messa
For example, with the final lines of `src/main/fc/fc_init.c` set to:

```
LOG_ERROR(LOG_TOPIC_SYSTEM, "Init is complete");
LOG_ERROR(SYSTEM, "Init is complete");
systemState |= SYSTEM_STATE_READY;
```

Expand Down

0 comments on commit dc3e955

Please sign in to comment.