Skip to content

Commit

Permalink
AP_Tuning: Update OSD on 5 percent change
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury-MonZon committed Dec 11, 2024
1 parent 1b1261c commit ff66741
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions libraries/AP_Tuning/AP_Tuning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ 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 @@ -227,11 +228,14 @@ void AP_Tuning::check_input(uint8_t flightmode)
need_revert |= (1U << current_parm_index);
set_value(current_parm, new_value);

GCS_SEND_TEXT(MAV_SEVERITY_INFO,
"Tuning %s%s%0.5f",
get_tuning_name(current_parm),
((chan_value < dead_zone) && (chan_value > -dead_zone)) ? "> " : ": ",
(double)(new_value));
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",
get_tuning_name(current_parm),
((chan_value < dead_zone) && (chan_value > -dead_zone)) ? "> " : ": ",
(double)(new_value));
}

#if HAL_LOGGING_ENABLED
Log_Write_Parameter_Tuning(new_value);
Expand Down

0 comments on commit ff66741

Please sign in to comment.