Skip to content

Commit

Permalink
AP_Tuning: Show current parameter value on OSD and GCS
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury-MonZon committed Dec 10, 2024
1 parent 42ad2a7 commit a66735e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libraries/AP_Tuning/AP_Tuning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,17 @@ void AP_Tuning::check_input(uint8_t flightmode)

//hal.console->printf("chan_value %.2f last_channel_value %.2f\n", chan_value, last_channel_value);

const float dead_zone = 0.02;
if (mid_point_wait) {
// see if we have crossed the mid-point. We use a small deadzone to make it easier
// to move to the "indent" portion of a slider to start tuning
const float dead_zone = 0.02;
if ((chan_value > dead_zone && last_channel_value > 0) ||
(chan_value < -dead_zone && last_channel_value < 0)) {
// still waiting
return;
}
// starting tuning
mid_point_wait = false;
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Tuning: mid-point %s", get_tuning_name(current_parm));
AP_Notify::events.tune_started = 1;
}
last_channel_value = chan_value;
Expand All @@ -228,6 +227,12 @@ 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 HAL_LOGGING_ENABLED
Log_Write_Parameter_Tuning(new_value);
#endif
Expand Down

0 comments on commit a66735e

Please sign in to comment.