ArduinoMega2560_SPI 1.0
Cargando...
Buscando...
Nada coincide
Referencia del archivo msg.h
#include <Arduino.h>
#include "system/config/config.h"
Gráfico de dependencias incluidas en msg.h:
Gráfico de los archivos que directa o indirectamente incluyen a este archivo:

Ir al código fuente de este archivo.

Funciones

void standardMessage (const char *message, const char *file, const char *function, const char *date, const char *time)
 Prints an enriched log message to the serial monitor.
void standardHeader (const char *message, uint16_t width=200, char deco='-')
 Imprime un encabezado decorativo con el mensaje centrado.
void standardHeaderFull (const char *message, const char *file, const char *function, const char *date, const char *time, uint16_t width=120, char deco='-')
 Prints a decorated header with centered text and padding on both sides.
void standardErrorMessage (const char *message, const char *file, const char *function, const char *date, const char *time, int line)
 Prints an enriched error message to the serial monitor, including contextual information.
void showConfigurationMessage (const configuracionMain &configuration)
 Displays the current system configuration status on the serial monitor.
void printVersion (const char *fwVersion, const char *fwName, const char *fwDate, const char *fwAuthor, const char *appVersion, const char *appName, const char *appDate)
 Prints firmware version details to the serial monitor.

Documentación de funciones

◆ printVersion()

void printVersion ( const char * fwVersion,
const char * fwName,
const char * fwDate,
const char * fwAuthor,
const char * appVersion,
const char * appName,
const char * appDate )

Prints firmware version details to the serial monitor.

Displays firmware and application information (version, name, date, author) defined by macros in a clear format for easy verification.

Prints firmware version details to the serial monitor.

Muestra:

  • versión del firmware
  • nombre
  • fecha
  • autor
  • versión de la aplicación
  • nombre de la aplicación
  • fecha de la aplicación

Definición en la línea 248 del archivo msg.cpp.

254 {
255 standardMessage("Firmware Version Information",
256 __FILE__,
257 __FUNCTION__,
258 __DATE__,
259 __TIME__);
260 Serial.print("Firmware Version: "); Serial.println(fwVersion);
261 Serial.print("Firmware Name: "); Serial.println(fwName);
262 Serial.print("Firmware Date: "); Serial.println(fwDate);
263 Serial.print("Firmware Author: "); Serial.println(fwAuthor);
264 Serial.print("App Version: "); Serial.println(appVersion);
265 Serial.print("App Name: "); Serial.println(appName);
266 Serial.print("App Date: "); Serial.println(appDate);
267}
void standardMessage(const char *message, const char *file, const char *function, const char *date, const char *time)
Imprime un mensaje estandarizado y formateado en el monitor serie.
Definition msg.cpp:15
Gráfico de llamadas de esta función:
Gráfico de llamadas a esta función:

◆ showConfigurationMessage()

void showConfigurationMessage ( const configuracionMain & configuration)

Displays the current system configuration status on the serial monitor.

This function prints the current values of the fields defined in the configuracionMain structure, such as debug mode and LED project status, in a user-friendly format to facilitate system diagnostics or verification.

Parámetros
configurationStructure containing the main system configuration.

Displays the current system configuration status on the serial monitor.

Presenta los valores de la estructura configuracionMain con un formato visual claro y amigable.

Parámetros
configurationEstructura de configuración del sistema.

Definición en la línea 203 del archivo msg.cpp.

203 {
204 standardMessage("Current System Configuration",
205 __FILE__,
206 __FUNCTION__,
207 __DATE__,
208 __TIME__);
209 Serial.print("🔧 Debug mode: ");
210 Serial.println(configuration.debugMode ? "Enabled" : "Disabled");
211
212 standardHeaderFull("End of Configuration",
213 __FILE__,
214 __FUNCTION__,
215 __DATE__,
216 __TIME__,
217 120,
218 '-');
219}
void standardHeaderFull(const char *message, const char *file, const char *function, const char *date, const char *time, uint16_t width, char deco)
Imprime un encabezado decorado con texto centrado y metadatos.
Definition msg.cpp:121
uint8_t debugMode
Definition config.h:15
Gráfico de llamadas de esta función:

◆ standardErrorMessage()

void standardErrorMessage ( const char * message,
const char * file,
const char * function,
const char * date,
const char * time,
int line )

Prints an enriched error message to the serial monitor, including contextual information.

This function generates a structured output that helps identify the origin of runtime errors. The output includes:

  • Compilation date and time
  • Source file name
  • Function name from which it is invoked
  • Line number where the function was called
  • Custom error message

Output format: [date time] file::function (Line N) ❌ ERROR ➤ message

Example output: [Aug 7 2025 01:23:00] sensor.cpp::readSensor (Line 42) ❌ ERROR ➤ Failed to initialize sensor

Parámetros
messageDescription of the specific error
fileSource file name (FILE)
functionFunction name where the error was detected (FUNCTION)
dateCompilation date (DATE)
timeCompilation time (TIME)
lineLine number in the file where the function is invoked (LINE)

Prints an enriched error message to the serial monitor, including contextual information.

Incluye:

  • fecha y hora
  • archivo
  • función
  • número de línea
  • mensaje de error
Parámetros
messageMensaje de error.
fileArchivo origen.
functionFunción origen.
dateFecha de compilación.
timeHora de compilación.
lineNúmero de línea donde se invoca.

Definición en la línea 177 del archivo msg.cpp.

177 {
178 Serial.println();
179 Serial.print("[");
180 Serial.print(date);
181 Serial.print(" ");
182 Serial.print(time);
183 Serial.print("] ");
184 Serial.print(file);
185 Serial.print("::");
186 Serial.print(function);
187 Serial.print(" (Line ");
188 Serial.print(line);
189 Serial.print(") ❌ ERROR ➤ ");
190 Serial.println(message);
191 Serial.println();
192}

◆ standardHeader()

void standardHeader ( const char * message,
uint16_t width,
char deco )

Imprime un encabezado decorativo con el mensaje centrado.

Prints a centered header with decorative lines above/below. This is a reduced version without metadata, ideal for section titles.

Parámetros
messageThe title text to display centered.
widthTotal width of the decorative line (default: 200).
decoDecorative character to use (default: '-').

Genera una línea con caracteres decorativos a ambos lados del texto, manteniendo un ancho total definido por el usuario.

Parámetros
messageTexto a centrar.
widthAncho total de la línea.
decoCarácter decorativo.

Definición en la línea 72 del archivo msg.cpp.

74 {
75 int msgLen = strlen(message);
76 int totalDeco = width - msgLen - 2; // Subtract 2 for spacing around the message
77 if (totalDeco < 0) totalDeco = 0;
78
79 int leftDeco = totalDeco / 2;
80 int rightDeco = totalDeco - leftDeco;
81
82 // 🔹 Blank line before the header
83 Serial.println();
84
85 // 🔹 Left decorative padding
86 for (int i = 0; i < leftDeco; i++) Serial.write(deco);
87
88 // 🔹 Centered message with spacing
89 Serial.print(' ');
90 Serial.print(message);
91 Serial.print(' ');
92
93 // 🔹 Right decorative padding
94 for (int i = 0; i < rightDeco; i++) Serial.write(deco);
95
96 // 🔹 Blank line after the header
97 Serial.println();
98 Serial.println();
99}

◆ standardHeaderFull()

void standardHeaderFull ( const char * message,
const char * file,
const char * function,
const char * date,
const char * time,
uint16_t width,
char deco )

Prints a decorated header with centered text and padding on both sides.

This function builds a single line consisting of a combined text that includes the message, file, function, date, and time, surrounded by decorative characters on the left and right to achieve a total line width specified by the user.

Output format example: --— Message | file | function | date time --—

Parámetros
messageMain text or description to display.
fileFile path or source file name.
functionName of the function where this is called.
dateCompilation date (recommended: DATE).
timeCompilation time (recommended: TIME).
widthTotal width of the line (default: 120).
decoDecorative character (default: '-').
Nota
The number of decorative characters is automatically adjusted to keep the text centered within the given width.

Prints a decorated header with centered text and padding on both sides.

Construye una línea única que incluye:

  • mensaje principal
  • archivo
  • función
  • fecha y hora

Todo ello centrado y rodeado de caracteres decorativos.

Parámetros
messageMensaje principal.
fileArchivo origen.
functionFunción origen.
dateFecha de compilación.
timeHora de compilación.
widthAncho total de la línea.
decoCarácter decorativo.

Definición en la línea 121 del archivo msg.cpp.

127 {
128 char buffer[256];
129 // Build the full message with metadata
130 snprintf(buffer, sizeof(buffer), "%s | %s | %s | %s %s",
131 message, file, function, date, time);
132
133 int msgLen = strlen(buffer);
134 int totalDeco = width - msgLen - 2; // Subtract 2 for spacing around the message
135 if (totalDeco < 0) totalDeco = 0; // Prevent negative padding
136
137 int leftDeco = totalDeco / 2;
138 int rightDeco = totalDeco - leftDeco;
139
140 // 🔹 Blank line before the header
141 Serial.println();
142
143 // 🔹 Left decorative padding
144 for (int i = 0; i < leftDeco; i++) Serial.write(deco);
145
146 // 🔹 Centered message with spacing
147 Serial.print(' ');
148 Serial.print(buffer);
149 Serial.print(' ');
150
151 // 🔹 Right decorative padding
152 for (int i = 0; i < rightDeco; i++) Serial.write(deco);
153
154 // 🔹 Blank lines after the header
155 Serial.println();
156 Serial.println();
157}
Gráfico de llamadas a esta función:

◆ standardMessage()

void standardMessage ( const char * message,
const char * file,
const char * function,
const char * date,
const char * time )

Prints an enriched log message to the serial monitor.

This function should be defined in the corresponding source (.cpp) file. It generates a structured output that includes:

  • Compilation date and time
  • Source file from which it is called
  • Name of the calling function
  • Custom message

Output format: [date time] file::function ➤ message

Example: [Aug 7 2025 01:23:00] main.cpp::setup ➤ System initialization...

Parámetros
messageCustom text to be printed
fileSource file name (FILE)
functionName of the calling function (FUNCTION)
dateCompilation date (DATE)
timeCompilation time (TIME)

Prints an enriched log message to the serial monitor.

El mensaje aparece centrado entre dos líneas decorativas y acompañado de información contextual como archivo, función, fecha y hora.

Parámetros
messageMensaje principal a mostrar.
fileNombre del archivo origen.
functionNombre de la función desde donde se llama.
dateFecha de compilación o personalizada.
timeHora de compilación o personalizada.

Definición en la línea 15 del archivo msg.cpp.

19 {
20 const uint8_t totalWidth = 200; // Total width of the decorative line
21 int msgLen = strlen(message); // Length of the message text
22 int padding = (totalWidth - msgLen) / 2; // Spaces to add on the left to center the text
23
24 Serial.println();
25
26 // ─────────────────────────────
27 // Top decorative line
28 // ─────────────────────────────
29 for (uint8_t i = 0; i < totalWidth; i++) Serial.write('-');
30 Serial.println();
31
32 // ─────────────────────────────
33 // Centered message text
34 // ─────────────────────────────
35 for (int i = 0; i < padding; i++) Serial.write(' '); // Left padding
36 Serial.println(message); // Main message
37
38 // ─────────────────────────────
39 // Bottom decorative line
40 // ─────────────────────────────
41 for (uint8_t i = 0; i < totalWidth; i++) Serial.write('-');
42 Serial.println();
43
44 // ─────────────────────────────
45 // Detailed information below the main message
46 // ─────────────────────────────
47 Serial.print("[");
48 Serial.print(date);
49 Serial.print(" ");
50 Serial.print(time);
51 Serial.print("] ");
52 Serial.print(file);
53 Serial.print("::");
54 Serial.print(function);
55 Serial.print(" ➤ ");
56 Serial.println(message);
57
58 Serial.println();
59}
Gráfico de llamadas a esta función: