Copter: clarify takeoff_timer_start alt units
No functional change
This commit is contained in:
parent
f79ac46d60
commit
89345bad7a
@ -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();
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user