From 016eeaa258eb6a7045ec261eed56631b07f62a67 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 12 Jul 2017 17:21:28 +1000 Subject: [PATCH] Copter: move handling of incoming statutext messages up --- ArduCopter/GCS_Mavlink.cpp | 19 +++++-------------- ArduCopter/GCS_Mavlink.h | 2 ++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index dcde9e43c3..81d55830e4 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -333,6 +333,11 @@ void Copter::send_pid_tuning(mavlink_channel_t chan) } } +uint8_t GCS_MAVLINK_Copter::sysid_my_gcs() const +{ + return copter.g.sysid_my_gcs; +} + uint32_t GCS_MAVLINK_Copter::telem_delay() const { return (uint32_t)(copter.g.telem_delay); @@ -886,20 +891,6 @@ void GCS_MAVLINK_Copter::handleMessage(mavlink_message_t* msg) break; } - case MAVLINK_MSG_ID_STATUSTEXT: - { - // ignore any statustext messages not from our GCS: - if (msg->sysid != copter.g.sysid_my_gcs) { - break; - } - mavlink_statustext_t packet; - mavlink_msg_statustext_decode(msg, &packet); - char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1+4] = { 'G','C','S',':'}; - memcpy(&text[4], packet.text, MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN); - copter.DataFlash.Log_Write_Message(text); - break; - } - case MAVLINK_MSG_ID_GIMBAL_REPORT: { #if MOUNT == ENABLED diff --git a/ArduCopter/GCS_Mavlink.h b/ArduCopter/GCS_Mavlink.h index 4e317644d1..b4f8d398c4 100644 --- a/ArduCopter/GCS_Mavlink.h +++ b/ArduCopter/GCS_Mavlink.h @@ -20,6 +20,8 @@ protected: AP_Mission *get_mission() override; + uint8_t sysid_my_gcs() const override; + private: void handleMessage(mavlink_message_t * msg) override;