EmuFlight icon indicating copy to clipboard operation
EmuFlight copied to clipboard

Add cliDebugPrint functions to facilitate easy debug printing to CLI

Open Igorshp opened this issue 4 years ago • 3 comments

port of https://github.com/betaflight/betaflight/pull/8905

thanks to @etracer65 for original commit in betalfight

From linked PR:

To use, include cli/cli_debug_print.h in your code and be sure USE_CLI_DEBUG_PRINT is defined. Or alternately, build using make TARGET=<target_name> OPTIONS="USE_CLI_DEBUG_PRINT". Then you'll have access to the following functions to print debugging messages in the CLI:

cliDebugPrintLineFeed
cliDebugPrint
cliDebugPrintLine
cliDebugPrintf
cliDebugPrintLinef

Output is suppressed when the CLI is not open. The functions are equivalent to their cliPrint... counterparts.

May interfere with the autocomplete initialization when first entering the CLI if your code is outputting data when the CLI first opens. But as this is only meant for debugging it shouldn't be much of a concern.

You may also need to rate limit your messages if printing data in a loop.

Using these calls in other modules should only used for debugging and not left in any finished code.

Igorshp avatar Dec 22 '20 22:12 Igorshp

This proved quite handly debugging redpipeline code. I still wish there was a better way to look inside the brains of FC

Igorshp avatar Dec 22 '20 22:12 Igorshp

so how does this exactly work?

Quick-Flash avatar Apr 02 '21 00:04 Quick-Flash

if this is still helpful/required, please update with master and we can merge.

nerdCopter avatar Jul 14 '21 15:07 nerdCopter

merging it. if it's not manually added to code-files at compile time, it changes nothing.

nerdCopter avatar May 04 '23 20:05 nerdCopter