MySensors Library & Examples  2.3.1
Macros
+ Collaboration diagram for Serial and debugging:

Detailed Description

These options control serial and debugging features and functionalities in the library.

Macros

#define MY_DEBUG
 Define MY_DEBUG to show debug prints. More...
 
#define MY_DEBUGDEVICE
 Define MY_DEBUGDEVICE to redirect debug prints. More...
 
#define MY_DEBUG_OTA
 Define MY_DEBUG_OTA to redirect debug prints to given node ID. More...
 
#define MY_DEBUG_OTA_DISABLE_ACK
 Define MY_DEBUG_OTA_DISABLE_ACK to send messages with no ACK flag. More...
 
#define MY_OTA_LOG_RECEIVER_FEATURE
 Define this to enable printing of OTA logs. More...
 
#define MY_OTA_LOG_SENDER_FEATURE
 Define this to enable printing of OTA logs. More...
 
#define MY_SPECIAL_DEBUG
 Define MY_SPECIAL_DEBUG to enable support for I_DEBUG messages. More...
 
#define MY_DISABLED_SERIAL
 Define MY_DISABLED_SERIAL if you want to use the UART TX/RX pins as normal I/O pins. More...
 
#define MY_BAUD_RATE   (115200ul)
 Serial output baud rate (debug prints and serial gateway speed). More...
 
#define MY_SERIAL_OUTPUT_SIZE   (120u)
 Maximum characters for serial output. More...
 

Macro Definition Documentation

#define MY_BAUD_RATE   (115200ul)

Serial output baud rate (debug prints and serial gateway speed).

The baud rate configured here must match the baud rate at the "other" end.

Warning
Depending on your target device and clock speed, certain baud rates might not work well.
#define MY_DEBUG

Define MY_DEBUG to show debug prints.

This option will add a lot to the size of the final sketch but is helpful to see what is actually is happening during development.

Note
Values in parenthesis indicate default values which will be used if you have not defined the flag in your sketch.
#define MY_DEBUG_OTA

Define MY_DEBUG_OTA to redirect debug prints to given node ID.

With this option debugging messages over serial are disabled. It's not possible to send debug messages generated by the radio. All other debug messages redirected to the given Node ID. The debug messages are sent unsigned.

This function allocates some additional memory for radio packet preparation and buffering. Debug messages are sent to child ID 255 (NODE_SENSOR_ID) as I_LOG_MESSAGE type.

You have to enable the MY_OTA_LOG_RECEIVER_FEATURE on the target node. Look into the LogOTAGateway and LogOTANode examples.

The output buffer can be configured via MY_SERIAL_OUTPUT_SIZE Transport related debugging is disabled when MY_DEBUG_OTA is enabled.

#define MY_DEBUG_OTA_DISABLE_ACK

Define MY_DEBUG_OTA_DISABLE_ACK to send messages with no ACK flag.

This option reduces the latency added by OTA debug messages by sending packages only once. You can loose debug messages.

#define MY_DEBUGDEVICE

Define MY_DEBUGDEVICE to redirect debug prints.

If defined, MY_DEBUGDEVICE replaces MY_SERIALDEVICE for the purpose of printing debug messages. This only applies to debugging.

The intent is to provide the ability to send debugging messages out a different serial port than what is being used for communication between nodes or from gateway to controller when this communication uses a serial interface. This assumes that the MY_DEBUGDEVICE serial interface already exists. It can be a hardware serial device or a software serial device.

#define MY_DISABLED_SERIAL

Define MY_DISABLED_SERIAL if you want to use the UART TX/RX pins as normal I/O pins.

Note
When defined, if you want to use the pins as a UART, you need to handle initialization and configuration yourself.
#define MY_OTA_LOG_RECEIVER_FEATURE

Define this to enable printing of OTA logs.

This option requires additional memory for buffering. The buffer size can be configured via MY_SERIAL_OUTPUT_SIZE.

#define MY_OTA_LOG_SENDER_FEATURE

Define this to enable printing of OTA logs.

This option requires additional memory for buffering. The buffer size can be configured via MY_SERIAL_OUTPUT_SIZE.

#define MY_SERIAL_OUTPUT_SIZE   (120u)

Maximum characters for serial output.

If you are running extremely low on memory, reducing this size might just save your day.

#define MY_SPECIAL_DEBUG

Define MY_SPECIAL_DEBUG to enable support for I_DEBUG messages.

I_DEBUG messages are sent from the controller to the node, which responds with the requested data. The request can be one of the following:

  • 'R': routing info (only repeaters): received msg XXYY (as stream), where XX is the node and YY the routing node
  • 'V': CPU voltage
  • 'F': CPU frequency
  • 'M': free memory
  • 'E': clear MySensors EEPROM area and reboot (i.e. "factory" reset)