diff --git a/libraries/AP_Tuning/AP_Tuning.cpp b/libraries/AP_Tuning/AP_Tuning.cpp index 87bbf15a13e8c7..c10e5b1253e539 100644 --- a/libraries/AP_Tuning/AP_Tuning.cpp +++ b/libraries/AP_Tuning/AP_Tuning.cpp @@ -123,6 +123,7 @@ void AP_Tuning::re_center(void) AP_Float *f = get_param_pointer(current_parm); if (f != nullptr) { center_value = f->get(); + old_value = 0.0; } mid_point_wait = true; } @@ -218,7 +219,6 @@ void AP_Tuning::check_input(uint8_t flightmode) last_channel_value = chan_value; float new_value; - static float old_value; if (chan_value > 0) { new_value = linear_interpolate(center_value, range*center_value, chan_value, 0, 1); } else { @@ -231,7 +231,7 @@ void AP_Tuning::check_input(uint8_t flightmode) if ( fabsf(new_value-old_value) > (0.05 * old_value) ) { old_value = new_value; GCS_SEND_TEXT(MAV_SEVERITY_INFO, - "Tuning %s%s%0.4f", + "Tuning: %s%s%0.4f", get_tuning_name(current_parm), ((chan_value < dead_zone) && (chan_value > -dead_zone)) ? "> " : ": ", (double)(new_value)); diff --git a/libraries/AP_Tuning/AP_Tuning.h b/libraries/AP_Tuning/AP_Tuning.h index 88ffda0c4b08ab..5aad12ea9b0192 100644 --- a/libraries/AP_Tuning/AP_Tuning.h +++ b/libraries/AP_Tuning/AP_Tuning.h @@ -64,6 +64,9 @@ class AP_Tuning uint32_t last_check_ms; + // last tuning value scaled + float old_value; + void Log_Write_Parameter_Tuning(float value); // the parameter we are tuning