Plane: fix divide by zero in transition time

This commit is contained in:
Hwurzburg 2021-12-10 11:34:47 -06:00 committed by Tom Pittenger
parent 98196e3cdd
commit 049f5f2135
1 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ const AP_Param::GroupInfo QuadPlane::var_info[] = {
// @DisplayName: Transition time
// @Description: Transition time in milliseconds after minimum airspeed is reached
// @Units: ms
// @Range: 0 30000
// @Range: 1 30000
// @User: Advanced
AP_GROUPINFO("TRANSITION_MS", 11, QuadPlane, transition_time_ms, 5000),
@ -1527,7 +1527,7 @@ void SLT_Transition::update()
transition_low_airspeed_ms = 0;
gcs().send_text(MAV_SEVERITY_INFO, "Transition done");
}
float trans_time_ms = (float)quadplane.transition_time_ms.get();
float trans_time_ms = MAX((float)quadplane.transition_time_ms.get(),1);
float transition_scale = (trans_time_ms - transition_timer_ms) / trans_time_ms;
float throttle_scaled = last_throttle * transition_scale;