diff --git a/libraries/AP_Button/AP_Button.cpp b/libraries/AP_Button/AP_Button.cpp index c9d59b3219..c21a947e22 100644 --- a/libraries/AP_Button/AP_Button.cpp +++ b/libraries/AP_Button/AP_Button.cpp @@ -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