mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
pios_debug: use PIOS_INCLUDE_DEBUG_CONSOLE to DEBUG_PRINTF(level, ...)
Inconsistent use of debug macros in board definition files resulted in BU compilation error. It was attempted to use PIOS_COM_SendFormattedStringNonBlocking() directly even if PIOS_COM was not included (like for BootloaderUpdater). So this function in pios_debug.c was replaced by DEBUG_PRINTF() macro. The macro itself is defined in pios_debug.h file. Its definitions are removed from board files. And to use it one has to define in pios_config.h: #define PIOS_INCLUDE_DEBUG_CONSOLE #define DEBUG_LEVEL <number> in addition to PIOS_INCLUDE_COM with aux port. Conflicts: flight/PiOS/Boards/STM32103CB_PIPXTREME_Rev1.h flight/PiOS/Boards/STM32F4xx_RevoMini.h
This commit is contained in:
parent
91f14768db
commit
ce4b2f4446
@ -191,12 +191,6 @@ extern uint32_t pios_ppm_out_id;
|
||||
#define PIOS_PPM_RECEIVER (pios_ppm_rcvr_id)
|
||||
#define PIOS_PPM_OUTPUT (pios_ppm_out_id)
|
||||
|
||||
#define DEBUG_LEVEL 2
|
||||
#if DEBUG_LEVEL > 1000
|
||||
#define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && PIOS_COM_DEBUG > 0) { PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__); }}
|
||||
#else
|
||||
#define DEBUG_PRINTF(...)
|
||||
#endif
|
||||
#define RFM22_DEBUG 1
|
||||
|
||||
//-------------------------
|
||||
|
@ -186,7 +186,7 @@ extern uint32_t pios_com_telem_usb_id;
|
||||
#define PIOS_COM_GPS (pios_com_gps_id)
|
||||
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
|
||||
#define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
|
||||
#define PIOS_COM_DEBUG PIOS_COM_AUX
|
||||
#define PIOS_COM_DEBUG (PIOS_COM_AUX)
|
||||
#define PIOS_COM_OSD (pios_com_aux_id)
|
||||
|
||||
//extern uint32_t pios_com_serial_id;
|
||||
@ -202,13 +202,6 @@ extern uint32_t pios_com_telem_usb_id;
|
||||
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
|
||||
#endif
|
||||
|
||||
#if defined(PIOS_COM_DEBUG)
|
||||
// #define DEBUG_PRINTF(...) PIOS_COM_SendFormattedString(PIOS_COM_DEBUG, __VA_ARGS__)
|
||||
#define DEBUG_PRINTF(...) PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_PRINTF(...)
|
||||
#endif
|
||||
|
||||
// *****************************************************************
|
||||
// ADC
|
||||
|
||||
|
@ -31,13 +31,6 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
|
||||
#define DEBUG_LEVEL 0
|
||||
#define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && pios_com_debug_id > 0) { PIOS_COM_SendFormattedStringNonBlocking(pios_com_debug_id, __VA_ARGS__); }}
|
||||
#else
|
||||
#define DEBUG_PRINTF(level, ...)
|
||||
#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
|
||||
|
||||
//------------------------
|
||||
// Timers and Channels Used
|
||||
//------------------------
|
||||
|
@ -153,9 +153,9 @@ void PIOS_DEBUG_PinValue4BitL(uint8_t value)
|
||||
*/
|
||||
void PIOS_DEBUG_Panic(const char *msg)
|
||||
{
|
||||
#ifdef PIOS_COM_DEBUG
|
||||
#ifdef PIOS_INCLUDE_DEBUG_CONSOLE
|
||||
register int *lr asm("lr"); // Link-register holds the PC of the caller
|
||||
PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, "\r%s @0x%x\r", msg, lr);
|
||||
DEBUG_PRINTF(0, "\r%s @0x%x\r", msg, lr);
|
||||
#endif
|
||||
|
||||
// Stay put
|
||||
|
@ -153,9 +153,9 @@ void PIOS_DEBUG_PinValue4BitL(uint8_t value)
|
||||
*/
|
||||
void PIOS_DEBUG_Panic(const char *msg)
|
||||
{
|
||||
#ifdef PIOS_COM_DEBUG
|
||||
#ifdef PIOS_INCLUDE_DEBUG_CONSOLE
|
||||
register int *lr asm("lr"); // Link-register holds the PC of the caller
|
||||
PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, "\r%s @0x%x\r", msg, lr);
|
||||
DEBUG_PRINTF(0, "\r%s @0x%x\r", msg, lr);
|
||||
#endif
|
||||
|
||||
// Stay put
|
||||
|
@ -31,6 +31,20 @@
|
||||
#ifndef PIOS_DEBUG_H
|
||||
#define PIOS_DEBUG_H
|
||||
|
||||
#ifdef PIOS_INCLUDE_DEBUG_CONSOLE
|
||||
#ifndef DEBUG_LEVEL
|
||||
#define DEBUG_LEVEL 0
|
||||
#endif
|
||||
#define DEBUG_PRINTF(level, ...) \
|
||||
{ \
|
||||
if ((level <= DEBUG_LEVEL) && (PIOS_COM_DEBUG > 0)) { \
|
||||
PIOS_COM_SendFormattedStringNonBlocking(PIOS_COM_DEBUG, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define DEBUG_PRINTF(level, ...)
|
||||
#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
|
||||
|
||||
extern const char *PIOS_DEBUG_AssertMsg;
|
||||
|
||||
#ifdef USE_SIM_POSIX
|
||||
|
@ -36,6 +36,9 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
/* #define PIOS_INCLUDE_DEBUG_CONSOLE */
|
||||
/* #define DEBUG_LEVEL 0 */
|
||||
|
||||
#define PIOS_INCLUDE_FREERTOS
|
||||
#define PIOS_INCLUDE_DELAY
|
||||
#define PIOS_INCLUDE_INITCALL
|
||||
|
@ -117,8 +117,8 @@ void processReset(void)
|
||||
if (RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET)
|
||||
{ // Independant Watchdog Reset
|
||||
|
||||
#if defined(PIOS_COM_DEBUG)
|
||||
DEBUG_PRINTF("\r\nINDEPENDANT WATCHDOG CAUSED A RESET\r\n");
|
||||
#if defined(PIOS_COM_DEBUG_CONSOLE)
|
||||
DEBUG_PRINTF(0, "\r\nINDEPENDANT WATCHDOG CAUSED A RESET\r\n");
|
||||
#endif
|
||||
|
||||
// all led's ON
|
||||
@ -136,7 +136,7 @@ void processReset(void)
|
||||
if (RCC_GetFlagStatus(RCC_FLAG_WWDGRST) != RESET)
|
||||
{ // Window Watchdog Reset
|
||||
|
||||
DEBUG_PRINTF("\r\nWINDOW WATCHDOG CAUSED A REBOOT\r\n");
|
||||
DEBUG_PRINTF(0, "\r\nWINDOW WATCHDOG CAUSED A REBOOT\r\n");
|
||||
|
||||
// all led's ON
|
||||
USB_LED_ON;
|
||||
@ -156,28 +156,28 @@ void processReset(void)
|
||||
if (RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET)
|
||||
{ // Power-On Reset
|
||||
#if defined(PIOS_COM_DEBUG)
|
||||
DEBUG_PRINTF("\r\nPOWER-ON-RESET\r\n");
|
||||
DEBUG_PRINTF(0, "\r\nPOWER-ON-RESET\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (RCC_GetFlagStatus(RCC_FLAG_SFTRST) != RESET)
|
||||
{ // Software Reset
|
||||
#if defined(PIOS_COM_DEBUG)
|
||||
DEBUG_PRINTF("\r\nSOFTWARE RESET\r\n");
|
||||
DEBUG_PRINTF(0, "\r\nSOFTWARE RESET\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (RCC_GetFlagStatus(RCC_FLAG_LPWRRST) != RESET)
|
||||
{ // Low-Power Reset
|
||||
#if defined(PIOS_COM_DEBUG)
|
||||
DEBUG_PRINTF("\r\nLOW POWER RESET\r\n");
|
||||
DEBUG_PRINTF(0, "\r\nLOW POWER RESET\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET)
|
||||
{ // Pin Reset
|
||||
#if defined(PIOS_COM_DEBUG)
|
||||
DEBUG_PRINTF("\r\nPIN RESET\r\n");
|
||||
DEBUG_PRINTF("0, \r\nPIN RESET\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,9 @@
|
||||
* details.
|
||||
*/
|
||||
|
||||
/* #define PIOS_INCLUDE_DEBUG_CONSOLE */
|
||||
/* #define DEBUG_LEVEL 0 */
|
||||
|
||||
#define PIOS_INCLUDE_FREERTOS
|
||||
#define PIOS_INCLUDE_DELAY
|
||||
#define PIOS_INCLUDE_INITCALL
|
||||
|
@ -60,7 +60,7 @@ extern uint32_t pios_com_spectrum_id;
|
||||
|
||||
#ifdef PIOS_ENABLE_AUX_UART
|
||||
#define PIOS_COM_AUX (pios_com_aux_id)
|
||||
#define PIOS_COM_DEBUG (PIOS_COM_AUX
|
||||
#define PIOS_COM_DEBUG (PIOS_COM_AUX)
|
||||
#endif
|
||||
|
||||
#define PIOS_GCSRCVR_TIMEOUT_MS 200
|
||||
|
Loading…
x
Reference in New Issue
Block a user