Copter: clarify takeoff_timer_start alt units

No functional change
This commit is contained in:
Randy Mackay 2015-06-22 11:59:43 +09:00
parent f79ac46d60
commit 89345bad7a
2 changed files with 5 additions and 5 deletions

View File

@ -888,7 +888,7 @@ private:
bool should_log(uint32_t mask);
bool current_mode_has_user_takeoff(bool must_navigate);
bool do_user_takeoff(float takeoff_alt_cm, bool must_navigate);
void takeoff_timer_start(float alt);
void takeoff_timer_start(float alt_cm);
void takeoff_stop();
void takeoff_get_climb_rates(float& pilot_climb_rate, float& takeoff_climb_rate);
void print_hit_enter();

View File

@ -45,14 +45,14 @@ bool Copter::do_user_takeoff(float takeoff_alt_cm, bool must_navigate)
return false;
}
// start takeoff to specified altitude above home
void Copter::takeoff_timer_start(float alt)
// start takeoff to specified altitude above home in centimeters
void Copter::takeoff_timer_start(float alt_cm)
{
// calculate climb rate
float speed = min(wp_nav.get_speed_up(), max(g.pilot_velocity_z_max*2.0f/3.0f, g.pilot_velocity_z_max-50.0f));
// sanity check speed and target
if (takeoff_state.running || speed <= 0.0f || alt <= 0.0f) {
if (takeoff_state.running || speed <= 0.0f || alt_cm <= 0.0f) {
return;
}
@ -60,7 +60,7 @@ void Copter::takeoff_timer_start(float alt)
takeoff_state.running = true;
takeoff_state.speed = speed;
takeoff_state.start_ms = millis();
takeoff_state.time_ms = (alt/takeoff_state.speed) * 1.0e3f;
takeoff_state.time_ms = (alt_cm/takeoff_state.speed) * 1.0e3f;
}
// stop takeoff