From 72d76558a71bf5a54ef6664e1db8d4ad923b797d Mon Sep 17 00:00:00 2001 From: rmackay9 Date: Sun, 3 Jun 2012 23:48:45 +0900 Subject: [PATCH] ArduCopter: Ensure update_GPS does nothing when gps is disabled. This fixes a bug in which an APM without a GPS would not work because it would constantly scan for a valid GPS long after it should have given up and moved on. --- ArduCopter/ArduCopter.pde | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index f615e98e7b..167788aff2 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -1331,6 +1331,11 @@ static void update_GPS(void) // A counter that is used to grab at least 10 reads before commiting the Home location static byte ground_start_count = 10; + // return immediately if GPS is not enabled + if( !GPS_enabled ) { + return; + } + g_gps->update(); update_GPS_light();