AP_Button: allow more libraries to compile with no HAL_GCS_ENABLED

This commit is contained in:
Peter Barker 2023-09-02 15:21:34 +10:00 committed by Peter Barker
parent 996399331b
commit 498fc97bae
1 changed files with 5 additions and 1 deletions

View File

@ -212,6 +212,7 @@ void AP_Button::update(void)
pwm_start_debounce_ms = now_ms;
}
#if HAL_GCS_ENABLED
if (last_debounce_ms != 0 &&
(AP_HAL::millis() - last_report_ms) > AP_BUTTON_REPORT_PERIOD_MS &&
(AP_HAL::millis64() - last_debounce_ms) < report_send_time*1000ULL) {
@ -221,6 +222,7 @@ void AP_Button::update(void)
// send a report to GCS
send_report();
}
#endif
if (!aux_functions_initialised) {
run_aux_functions(true);
@ -273,7 +275,7 @@ void AP_Button::run_aux_functions(bool force)
#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED
const char *str = rc_channel->string_for_aux_function(func);
if (str != nullptr) {
gcs().send_text(MAV_SEVERITY_INFO, "Button %i: executing (%s %s)", i+1, str, rc_channel->string_for_aux_pos(pos));
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Button %i: executing (%s %s)", i+1, str, rc_channel->string_for_aux_pos(pos));
}
#endif
rc_channel->run_aux_function(func, pos, RC_Channel::AuxFuncTriggerSource::BUTTON);
@ -338,6 +340,7 @@ void AP_Button::timer_update(void)
}
}
#if HAL_GCS_ENABLED
/*
send a BUTTON_CHANGE report to the GCS
*/
@ -352,6 +355,7 @@ void AP_Button::send_report(void) const
gcs().send_to_active_channels(MAVLINK_MSG_ID_BUTTON_CHANGE,
(const char *)&packet);
}
#endif
/*
setup the pins as input with pullup. We need pullup to give reliable