Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] update serial_printf document iaw current implementation #9266

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading