Made landing disarm the motors

This commit is contained in:
Jason Short 2012-01-03 23:29:28 -08:00
parent ed1ff0b171
commit 40c649a27b

View File

@ -356,13 +356,16 @@ static bool verify_land()
if (velocity_land == -1) if (velocity_land == -1)
velocity_land = 2000; velocity_land = 2000;
if (current_loc.alt < 500){
// a LP filter used to tell if we have landed // a LP filter used to tell if we have landed
// will drive to 0 if we are on the ground - maybe, the baro is noisy // will drive to 0 if we are on the ground - maybe, the baro is noisy
velocity_land = ((velocity_land * 7) + (old_alt - current_loc.alt)) / 8; velocity_land = ((velocity_land * 7) + (old_alt - current_loc.alt)) / 8;
}
old_alt = current_loc.alt; old_alt = current_loc.alt;
if (current_loc.alt < 300){ if (current_loc.alt < 300){
wp_control = NO_NAV_MODE; wp_control = NO_NAV_MODE;
// Update by JLN for a safe AUTO landing // Update by JLN for a safe AUTO landing
@ -381,12 +384,12 @@ static bool verify_land()
} }
} }
if(velocity_land <= 0){ if(current_loc.alt < 300 && velocity_land <= 100){
land_complete = true; land_complete = true;
// reset old_alt // reset old_alt
old_alt == 0; old_alt == 0;
// commented out to prevent tragedy init_disarm_motors();
//return true; return true;
} }
//Serial.printf("N, %d\n", velocity_land); //Serial.printf("N, %d\n", velocity_land);
//Serial.printf("N_alt, %ld\n", next_WP.alt); //Serial.printf("N_alt, %ld\n", next_WP.alt);