From 3f77ddd497a3dc3b3a7f8e262e8a392f47e057ca Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Thu, 27 Aug 2015 14:38:00 +0900 Subject: [PATCH] Tracker: sanity check home location parameters --- AntennaTracker/system.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AntennaTracker/system.cpp b/AntennaTracker/system.cpp index faff36e0dc..bb2e509615 100644 --- a/AntennaTracker/system.cpp +++ b/AntennaTracker/system.cpp @@ -94,8 +94,12 @@ void Tracker::init_tracker() // use given start positions - useful for indoor testing, and // while waiting for GPS lock - current_loc.lat = g.start_latitude * 1.0e7f; - current_loc.lng = g.start_longitude * 1.0e7f; + // sanity check location + if (fabsf(current_loc.lat) <= 90.0f && fabsf(current_loc.lng) <= 180.0f) { + current_loc.lat = g.start_latitude * 1.0e7f; + current_loc.lng = g.start_longitude * 1.0e7f; + gcs_send_text_P(MAV_SEVERITY_WARNING, PSTR("ignoring invalid START_LATITUDE or START_LONGITUDE parameter")); + } // see if EEPROM has a default location as well if (current_loc.lat == 0 && current_loc.lng == 0) {