Skip to content

Debugging

Hrisabh Yadav edited this page Nov 14, 2025 · 1 revision

Debugging.h

Debugging and monitoring functions for system output and OLED display.

Monitor Functions

void Monitor_Print(const char *msg)

Prints message to monitor without newline.

void Monitor_Print(const char *tag, int number)

Prints tag followed by integer number.

void Monitor_Print(const char *tag, double number, uint8_t precision)

Prints tag followed by double with specified precision.

void Monitor_Println(const char *msg)

Prints message followed by newline.

void Monitor_Println(const char *tag, int number)

Prints tag and integer followed by newline.

void Monitor_Println(const char *tag, double number, uint8_t precision)

Prints tag and double with precision followed by newline.

OLED Functions

void Oled_Init(void)

Initializes OLED display for use.

void Oled_Clear(void)

Clears the OLED display.

void Oled_Print(uint8_t col, uint8_t row, const char *string)

Prints string at specified position on OLED.

Parameters:

  • col - Column position (starting from 0)
  • row - Row position (starting from 0)
  • string - Text to display

Black Box Functions

void BlackBox_setVar(char *varName, int32_t &reference)

Associates variable name with integer reference for logging (if BLACKBOX defined).

Usage Example

// Monitor output
Monitor_Print("System: ");
Monitor_Println("Ready");
Monitor_Println("Altitude: ", 150);
Monitor_Println("Voltage: ", 12.45, 2);

// OLED display
Oled_Init();
Oled_Clear();
Oled_Print(0, 0, "MagisV2");
Oled_Print(0, 1, "Battery: 85%");

// Black box logging
#ifdef BLACKBOX
int32_t altitude = 0;
BlackBox_setVar("alt", altitude);
#endif

Clone this wiki locally