ArduinoMega2560_SPI 1.0
Cargando...
Buscando...
Nada coincide
Referencia del archivo msg.cpp
#include "system/msg/msg.h"
Gráfico de dependencias incluidas en msg.cpp:

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)
 Imprime un mensaje estandarizado y formateado en el monitor serie.
void standardHeader (const char *message, uint16_t width, 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, char deco)
 Imprime un encabezado decorado con texto centrado y metadatos.
void standardErrorMessage (const char *message, const char *file, const char *function, const char *date, const char *time, int line)
 Imprime un mensaje de error enriquecido con información contextual.
void showConfigurationMessage (const configuracionMain &configuration)
 Muestra la configuración actual del sistema.
void showMsgPrinLine (char c, int length)
 Imprime una línea compuesta por un carácter repetido.
void printVersion (const char *fwVersion, const char *fwName, const char *fwDate, const char *fwAuthor, const char *appVersion, const char *appName, const char *appDate)
 Imprime la información de versión del firmware.

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 )

Imprime la información de versión del firmware.

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)

Muestra la configuración actual del sistema.

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:

◆ showMsgPrinLine()

void showMsgPrinLine ( char c,
int length )

Imprime una línea compuesta por un carácter repetido.

Parámetros
cCarácter a imprimir.
lengthNúmero de repeticiones.

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

228 {
229 for (int i = 0; i < length; i++) {
230 Serial.print(c);
231 }
232 Serial.println();
233}

◆ standardErrorMessage()

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

Imprime un mensaje de error enriquecido con información contextual.

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.

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 )

Imprime un encabezado decorado con texto centrado y metadatos.

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 )

Imprime un mensaje estandarizado y formateado en el monitor serie.

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: