New OTA debugging and logging feature (#913) (#913)

This commit is contained in:
d00616
2017-09-18 20:58:44 +02:00
committed by Henrik Ekblad
parent 0ed558f1d0
commit 8412a3d360
9 changed files with 518 additions and 5 deletions
+74 -4
View File
@@ -47,6 +47,54 @@
*/
//#define MY_DEBUG
/**
* @def MY_DEBUG_OTA
* @brief 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 (0)
/**
* @def MY_DEBUG_OTA_DISABLE_ACK
* @brief 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_DEBUG_OTA_DISABLE_ACK
/**
* @def MY_OTA_LOG_RECEIVER_FEATURE
* @brief 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_RECEIVER_FEATURE
/**
* @def MY_OTA_LOG_SENDER_FEATURE
* @brief 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
/**
* @def MY_SPECIAL_DEBUG
* @brief Define MY_SPECIAL_DEBUG to enable support for I_DEBUG messages.
@@ -80,10 +128,6 @@
*/
//#define MY_SPLASH_SCREEN_DISABLED
#ifdef MY_DISABLED_SERIAL
#undef MY_DEBUG
#endif
/**
* @def MY_BAUD_RATE
* @brief Serial output baud rate (debug prints and serial gateway speed).
@@ -1221,6 +1265,7 @@
#define MY_INCLUSION_BUTTON_PRESSED (LOW)
#endif
/**************************************
* Ethernet Gateway Transport Defaults
***************************************/
@@ -1684,6 +1729,9 @@
#endif
// DEBUG
#if defined(MY_DISABLED_SERIAL) && !defined(MY_DEBUG_OTA)
#undef MY_DEBUG
#endif
#if defined(MY_DEBUG)
// standard debug output
#define MY_DEBUG_VERBOSE_CORE //!< MY_DEBUG_VERBOSE_CORE
@@ -1693,8 +1741,25 @@
#if defined(MY_DEBUG) || defined(MY_DEBUG_VERBOSE_CORE) || defined(MY_DEBUG_VERBOSE_TRANSPORT) || defined(MY_DEBUG_VERBOSE_SIGNING) || defined(MY_DEBUG_VERBOSE_OTA_UPDATE) || defined(MY_DEBUG_VERBOSE_RF24) || defined(MY_DEBUG_VERBOSE_NRF5_ESB) || defined(MY_DEBUG_VERBOSE_RFM69) || defined(MY_DEBUG_VERBOSE_RFM95)
#define DEBUG_OUTPUT_ENABLED //!< DEBUG_OUTPUT_ENABLED
#ifndef MY_DEBUG_OTA
#define DEBUG_OUTPUT(x,...) hwDebugPrint(x, ##__VA_ARGS__) //!< debug
#else
#ifndef MY_OTA_LOG_SENDER_FEATURE
#define MY_OTA_LOG_SENDER_FEATURE
#endif
#ifndef MY_DEBUG_OTA_DISABLE_ACK
#define DEBUG_OUTPUT(x,...) OTALog((MY_DEBUG_OTA), true, x, ##__VA_ARGS__) //!< debug
#else
#define DEBUG_OUTPUT(x,...) OTALog((MY_DEBUG_OTA), false, x, ##__VA_ARGS__) //!< debug
#endif
// disable radio related debugging messages
#undef MY_DEBUG_VERBOSE_RF24
#undef MY_DEBUG_VERBOSE_NRF5_ESB
#undef MY_DEBUG_VERBOSE_RFM69
#undef MY_DEBUG_VERBOSE_RFM69_REGISTERS
#undef MY_DEBUG_VERBOSE_RFM95
#endif
#else
#define DEBUG_OUTPUT(x,...) //!< debug NULL
#endif
@@ -1733,6 +1798,8 @@
#if DOXYGEN
// debug
#define MY_DEBUG
#define MY_DEBUG_OTA
#define MY_DEBUG_OTA_DISABLE_ACK
#define MY_SPECIAL_DEBUG
#define MY_DISABLED_SERIAL
#define MY_SPLASH_SCREEN_DISABLED
@@ -1742,6 +1809,9 @@
// inclusion mode
#define MY_INCLUSION_MODE_FEATURE
#define MY_INCLUSION_BUTTON_FEATURE
// OTA logging and debug
#define MY_OTA_LOG_RECEIVER_FEATURE
#define MY_OTA_LOG_SENDER_FEATURE
// transport
#define MY_PARENT_NODE_IS_STATIC
#define MY_REGISTRATION_CONTROLLER