Skip to content

Commit

Permalink
AP_Tuning: Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury-MonZon committed Dec 31, 2024
1 parent 9a6f288 commit 5a9cce5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_Tuning/AP_Tuning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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));
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_Tuning/AP_Tuning.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5a9cce5

Please sign in to comment.