From cbbd28aedaa8c358bd9a6e96291ddee6cf87347c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 16 May 2018 20:23:29 +1000 Subject: [PATCH] Tracker: let GCS_MAVLink handle get_home_position --- AntennaTracker/AntennaTracker.cpp | 9 +++++++++ AntennaTracker/GCS_Mavlink.cpp | 6 ------ AntennaTracker/system.cpp | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/AntennaTracker/AntennaTracker.cpp b/AntennaTracker/AntennaTracker.cpp index be94b07075..85e38b430a 100644 --- a/AntennaTracker/AntennaTracker.cpp +++ b/AntennaTracker/AntennaTracker.cpp @@ -106,6 +106,15 @@ void Tracker::one_second_loop() } one_second_counter = 0; } + + if (!ahrs.home_is_set()) { + // set home to current location + Location temp_loc; + if (ahrs.get_location(temp_loc)) { + set_home(temp_loc); + } + return; + } } void Tracker::ten_hz_logging_loop() diff --git a/AntennaTracker/GCS_Mavlink.cpp b/AntennaTracker/GCS_Mavlink.cpp index cd5018ccb9..c080251288 100644 --- a/AntennaTracker/GCS_Mavlink.cpp +++ b/AntennaTracker/GCS_Mavlink.cpp @@ -460,12 +460,6 @@ void GCS_MAVLINK_Tracker::handleMessage(mavlink_message_t* msg) } break; - case MAV_CMD_GET_HOME_POSITION: - send_home(); - send_ekf_origin(); - result = MAV_RESULT_ACCEPTED; - break; - case MAV_CMD_DO_SET_SERVO: if (tracker.servo_test_set_servo(packet.param1, packet.param2)) { result = MAV_RESULT_ACCEPTED; diff --git a/AntennaTracker/system.cpp b/AntennaTracker/system.cpp index 2c4a85cc39..6389290031 100644 --- a/AntennaTracker/system.cpp +++ b/AntennaTracker/system.cpp @@ -163,6 +163,7 @@ void Tracker::set_home(struct Location temp) Location ekf_origin; if (ahrs.get_origin(ekf_origin)) { ahrs.set_home(temp); + ahrs.set_home_status(HOME_SET_NOT_LOCKED); } gcs().send_home();