-
Notifications
You must be signed in to change notification settings - Fork 7
Debugging
Debugging and monitoring functions for printing to the debug serial monitor and exposing variables to the Black Box logger.
Note: OLED functions previously listed here have moved to their own module. See Oled.h for display output.
Debug output is generated as your code runs, so Monitor_* calls typically live
inside plutoLoop().
Prints a message with no trailing newline.
void plutoLoop ( void ) {
Monitor_Print ( "System: " );
}Prints a tag followed by an integer (no newline).
void plutoLoop ( void ) {
Monitor_Print ( "Altitude: ", 150 );
}Prints a tag followed by a floating-point value with the given decimal precision (no newline).
void plutoLoop ( void ) {
Monitor_Print ( "Voltage: ", 12.45, 2 ); // -> Voltage: 12.45
}Prints a message followed by a newline.
void plutoLoop ( void ) {
Monitor_Println ( "Ready" );
}Prints a tag and integer followed by a newline.
void plutoLoop ( void ) {
Monitor_Println ( "Loop count: ", 42 );
}Prints a tag and floating-point value (with precision) followed by a newline.
void plutoLoop ( void ) {
Monitor_Println ( "Pitch: ", -3.14159, 3 ); // -> Pitch: -3.142
}Only available when the firmware is built with
BLACKBOXdefined.
Registers a variable with the Black Box logger so its value is recorded under
varName. It is a one-time registration, so do it in onLoopStart(); the logger
then samples it automatically while the loop runs.
int32_t altitude = 0; // must outlive the call - use a global or static
void onLoopStart ( void ) {
#ifdef BLACKBOX
BlackBox_setVar ( "alt", altitude );
#endif
}Print debug output every loop from plutoLoop().
#include "PlutoPilot.h"
void plutoLoop ( void ) {
Monitor_Print ( "System: " );
Monitor_Println ( "Ready" );
Monitor_Println ( "Altitude: ", 150 ); // integer
Monitor_Println ( "Voltage: ", 12.45, 2 ); // double, 2 decimals
}Register the variable once in onLoopStart(); the logger records it automatically
while plutoLoop() updates its value.
#include "PlutoPilot.h"
int32_t altitude = 0; // global so it outlives the call
void onLoopStart ( void ) {
#ifdef BLACKBOX
BlackBox_setVar ( "alt", altitude );
#endif
}
void plutoLoop ( void ) {
altitude = Estimate_Get ( Position, Z ); // update the logged variable (altitude)
}MagisV2 © 2026 Drona Aviation | Licensed under GPL-3.0 | Report Issues