Skip to content

Commit

Permalink
GCS_MAVLink: use can_printf_severity() for AP_Periph
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Feb 18, 2024
1 parent e80ee19 commit 1674a3c
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions libraries/GCS_MAVLink/GCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -1346,9 +1346,9 @@ GCS &gcs();
#define AP_HAVE_GCS_SEND_TEXT 1
#else
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
#endif

Expand All @@ -1358,12 +1358,31 @@ void can_printf(const char *fmt, ...);

// map send text to can_printf() on larger AP_Periph boards
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 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 GCS_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
// empty send text when we have no GCS
#define GCS_SEND_TEXT(severity, format, args...)
Expand Down

0 comments on commit 1674a3c

Please sign in to comment.