GCS_MAVLink: use can_printf_severity() for AP_Periph

This commit is contained in:
Andrew Tridgell 2024-02-10 15:25:48 +11:00
parent ed27e30f9e
commit 632bb71c87
1 changed files with 23 additions and 4 deletions

View File

@ -1346,9 +1346,9 @@ GCS &gcs();
#define AP_HAVE_GCS_SEND_TEXT 1 #define AP_HAVE_GCS_SEND_TEXT 1
#else #else
extern "C" { extern "C" {
void can_printf(const char *fmt, ...); void can_printf_severity(uint8_t severity, const char *fmt, ...);
} }
#define GCS_SEND_TEXT(severity, format, args...) (void)severity; can_printf(format, ##args) #define GCS_SEND_TEXT(severity, format, args...) can_printf_severity(severity, format, ##args)
#define AP_HAVE_GCS_SEND_TEXT 1 #define AP_HAVE_GCS_SEND_TEXT 1
#endif #endif
@ -1358,12 +1358,31 @@ void can_printf(const char *fmt, ...);
// map send text to can_printf() on larger AP_Periph boards // map send text to can_printf() on larger AP_Periph boards
extern "C" { extern "C" {
void can_printf(const char *fmt, ...); void can_printf_severity(uint8_t severity, const char *fmt, ...);
} }
#define GCS_SEND_TEXT(severity, format, args...) can_printf(format, ##args) #define GCS_SEND_TEXT(severity, format, args...) can_printf_severity(severity, format, ##args)
#define GCS_SEND_MESSAGE(msg) #define GCS_SEND_MESSAGE(msg)
#define AP_HAVE_GCS_SEND_TEXT 1 #define AP_HAVE_GCS_SEND_TEXT 1
/*
we need a severity enum for the can_printf_severity function with no GCS present
*/
#ifndef HAVE_ENUM_MAV_SEVERITY
enum MAV_SEVERITY
{
MAV_SEVERITY_EMERGENCY=0,
MAV_SEVERITY_ALERT=1,
MAV_SEVERITY_CRITICAL=2,
MAV_SEVERITY_ERROR=3,
MAV_SEVERITY_WARNING=4,
MAV_SEVERITY_NOTICE=5,
MAV_SEVERITY_INFO=6,
MAV_SEVERITY_DEBUG=7,
MAV_SEVERITY_ENUM_END=8,
};
#define HAVE_ENUM_MAV_SEVERITY
#endif
#else // HAL_GCS_ENABLED #else // HAL_GCS_ENABLED
// empty send text when we have no GCS // empty send text when we have no GCS
#define GCS_SEND_TEXT(severity, format, args...) #define GCS_SEND_TEXT(severity, format, args...)