From 8de4ee734852f91c947953dbb522c866a9fd0743 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 14 Feb 2019 12:59:00 +1100 Subject: [PATCH] GCS_MAVLink: move update_sensor_status_flags into GCS subclasses --- libraries/GCS_MAVLink/GCS.cpp | 11 +++++++++++ libraries/GCS_MAVLink/GCS.h | 9 ++++++++- libraries/GCS_MAVLink/GCS_Dummy.h | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libraries/GCS_MAVLink/GCS.cpp b/libraries/GCS_MAVLink/GCS.cpp index 511058568f..21ba31320e 100644 --- a/libraries/GCS_MAVLink/GCS.cpp +++ b/libraries/GCS_MAVLink/GCS.cpp @@ -2,6 +2,17 @@ extern const AP_HAL::HAL& hal; +void GCS::get_sensor_status_flags(uint32_t &present, + uint32_t &enabled, + uint32_t &health) +{ + update_sensor_status_flags(); + + present = control_sensors_present; + enabled = control_sensors_enabled; + health = control_sensors_health; +} + /* send a text message to all GCS */ diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 0d9de7e201..cd2eda97a2 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -774,7 +774,14 @@ public: // update uart pass-thru void update_passthru(); - virtual void get_sensor_status_flags(uint32_t &present, uint32_t &enabled, uint32_t &health) = 0; + void get_sensor_status_flags(uint32_t &present, uint32_t &enabled, uint32_t &health); + +protected: + + uint32_t control_sensors_present; + uint32_t control_sensors_enabled; + uint32_t control_sensors_health; + virtual void update_sensor_status_flags(void) = 0; private: diff --git a/libraries/GCS_MAVLink/GCS_Dummy.h b/libraries/GCS_MAVLink/GCS_Dummy.h index 1a45d14763..20d9e138bb 100644 --- a/libraries/GCS_MAVLink/GCS_Dummy.h +++ b/libraries/GCS_MAVLink/GCS_Dummy.h @@ -54,5 +54,5 @@ class GCS_Dummy : public GCS void send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const char *text) { hal.console->printf("TOGCS: %s\n", text); } - void get_sensor_status_flags(uint32_t &present, uint32_t &enabled, uint32_t &health) override { present = 0; enabled = 0; health = 0; } + void update_sensor_status_flags(void) override {}; };