AP_GPS: use GCS_SEND_TEXT()

This commit is contained in:
Andrew Tridgell 2020-03-30 09:49:53 +11:00
parent 660f65e6b8
commit 4f591a338f
4 changed files with 9 additions and 15 deletions

View File

@ -1172,7 +1172,7 @@ void AP_GPS::broadcast_first_configuration_failure_reason(void) const
uint8_t unconfigured; uint8_t unconfigured;
if (first_unconfigured_gps(unconfigured)) { if (first_unconfigured_gps(unconfigured)) {
if (drivers[unconfigured] == nullptr) { if (drivers[unconfigured] == nullptr) {
gcs().send_text(MAV_SEVERITY_INFO, "GPS %d: was not found", unconfigured + 1); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "GPS %d: was not found", unconfigured + 1);
} else { } else {
drivers[unconfigured]->broadcast_configuration_failure_reason(); drivers[unconfigured]->broadcast_configuration_failure_reason();
} }

View File

@ -351,7 +351,7 @@ AP_GPS_SBF::process_message(void)
check_new_itow(temp.TOW, sbf_msg.length); check_new_itow(temp.TOW, sbf_msg.length);
RxState = temp.RxState; RxState = temp.RxState;
if ((RxError & RX_ERROR_MASK) != (temp.RxError & RX_ERROR_MASK)) { if ((RxError & RX_ERROR_MASK) != (temp.RxError & RX_ERROR_MASK)) {
gcs().send_text(MAV_SEVERITY_INFO, "GPS %u: SBF error changed (0x%08x/0x%08x)", (unsigned int)(state.instance + 1), GCS_SEND_TEXT(MAV_SEVERITY_INFO, "GPS %u: SBF error changed (0x%08x/0x%08x)", (unsigned int)(state.instance + 1),
(unsigned int)(RxError & RX_ERROR_MASK), (unsigned int)(temp.RxError & RX_ERROR_MASK)); (unsigned int)(RxError & RX_ERROR_MASK), (unsigned int)(temp.RxError & RX_ERROR_MASK));
} }
RxError = temp.RxError; RxError = temp.RxError;
@ -382,7 +382,7 @@ void AP_GPS_SBF::broadcast_configuration_failure_reason(void) const
{ {
if (gps._auto_config != AP_GPS::GPS_AUTO_CONFIG_DISABLE && if (gps._auto_config != AP_GPS::GPS_AUTO_CONFIG_DISABLE &&
_init_blob_index < ARRAY_SIZE(_initialisation_blob)) { _init_blob_index < ARRAY_SIZE(_initialisation_blob)) {
gcs().send_text(MAV_SEVERITY_INFO, "GPS %u: SBF is not fully configured (%u/%u)", state.instance + 1, GCS_SEND_TEXT(MAV_SEVERITY_INFO, "GPS %u: SBF is not fully configured (%u/%u)", state.instance + 1,
_init_blob_index, (unsigned)ARRAY_SIZE(_initialisation_blob)); _init_blob_index, (unsigned)ARRAY_SIZE(_initialisation_blob));
} }
} }
@ -404,7 +404,7 @@ void AP_GPS_SBF::mount_disk (void) const {
void AP_GPS_SBF::unmount_disk (void) const { void AP_GPS_SBF::unmount_disk (void) const {
const char* command = "emd, DSK1, Unmount\n"; const char* command = "emd, DSK1, Unmount\n";
gcs().send_text(MAV_SEVERITY_DEBUG, "SBF unmounting disk"); GCS_SEND_TEXT(MAV_SEVERITY_DEBUG, "SBF unmounting disk");
port->write((const uint8_t*)command, strlen(command)); port->write((const uint8_t*)command, strlen(command));
} }
@ -413,22 +413,22 @@ bool AP_GPS_SBF::prepare_for_arming(void) {
if (gps._raw_data) { if (gps._raw_data) {
if (!(RxState & SBF_DISK_MOUNTED)){ if (!(RxState & SBF_DISK_MOUNTED)){
is_logging = false; is_logging = false;
gcs().send_text(MAV_SEVERITY_INFO, "GPS %d: SBF disk is not mounted", state.instance + 1); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "GPS %d: SBF disk is not mounted", state.instance + 1);
// simply attempt to mount the disk, no need to check if the command was // simply attempt to mount the disk, no need to check if the command was
// ACK/NACK'd as we don't continuously attempt to remount the disk // ACK/NACK'd as we don't continuously attempt to remount the disk
gcs().send_text(MAV_SEVERITY_INFO, "GPS %d: Attempting to mount disk", state.instance + 1); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "GPS %d: Attempting to mount disk", state.instance + 1);
mount_disk(); mount_disk();
// reset the flag to indicate if we should be logging // reset the flag to indicate if we should be logging
_has_been_armed = false; _has_been_armed = false;
} }
else if (RxState & SBF_DISK_FULL) { else if (RxState & SBF_DISK_FULL) {
is_logging = false; is_logging = false;
gcs().send_text(MAV_SEVERITY_INFO, "GPS %d: SBF disk is full", state.instance + 1); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "GPS %d: SBF disk is full", state.instance + 1);
} }
else if (!(RxState & SBF_DISK_ACTIVITY)) { else if (!(RxState & SBF_DISK_ACTIVITY)) {
is_logging = false; is_logging = false;
gcs().send_text(MAV_SEVERITY_INFO, "GPS %d: SBF is not currently logging", state.instance + 1); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "GPS %d: SBF is not currently logging", state.instance + 1);
} }
} }

View File

@ -51,7 +51,7 @@ do { \
#if SBP_INFOREPORTING #if SBP_INFOREPORTING
# define Info(fmt, args ...) \ # define Info(fmt, args ...) \
do { \ do { \
gcs().send_text(MAV_SEVERITY_INFO, fmt "\n", ## args); \ GCS_SEND_TEXT(MAV_SEVERITY_INFO, fmt "\n", ## args); \
} while(0) } while(0)
#else #else
# define Info(fmt, args ...) # define Info(fmt, args ...)

View File

@ -47,12 +47,6 @@
extern const AP_HAL::HAL& hal; extern const AP_HAL::HAL& hal;
#ifdef HAL_NO_GCS
#define GCS_SEND_TEXT(severity, format, args...)
#else
#define GCS_SEND_TEXT(severity, format, args...) gcs().send_text(severity, format, ##args)
#endif
#if UBLOX_DEBUGGING #if UBLOX_DEBUGGING
# define Debug(fmt, args ...) do {hal.console->printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## args); hal.scheduler->delay(1); } while(0) # define Debug(fmt, args ...) do {hal.console->printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## args); hal.scheduler->delay(1); } while(0)
#else #else