mirror of https://github.com/ArduPilot/ardupilot
AP_Button: allow more libraries to compile with no HAL_GCS_ENABLED
This commit is contained in:
parent
996399331b
commit
498fc97bae
|
@ -212,6 +212,7 @@ void AP_Button::update(void)
|
||||||
pwm_start_debounce_ms = now_ms;
|
pwm_start_debounce_ms = now_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAL_GCS_ENABLED
|
||||||
if (last_debounce_ms != 0 &&
|
if (last_debounce_ms != 0 &&
|
||||||
(AP_HAL::millis() - last_report_ms) > AP_BUTTON_REPORT_PERIOD_MS &&
|
(AP_HAL::millis() - last_report_ms) > AP_BUTTON_REPORT_PERIOD_MS &&
|
||||||
(AP_HAL::millis64() - last_debounce_ms) < report_send_time*1000ULL) {
|
(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 a report to GCS
|
||||||
send_report();
|
send_report();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!aux_functions_initialised) {
|
if (!aux_functions_initialised) {
|
||||||
run_aux_functions(true);
|
run_aux_functions(true);
|
||||||
|
@ -273,7 +275,7 @@ void AP_Button::run_aux_functions(bool force)
|
||||||
#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED
|
#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED
|
||||||
const char *str = rc_channel->string_for_aux_function(func);
|
const char *str = rc_channel->string_for_aux_function(func);
|
||||||
if (str != nullptr) {
|
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
|
#endif
|
||||||
rc_channel->run_aux_function(func, pos, RC_Channel::AuxFuncTriggerSource::BUTTON);
|
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
|
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,
|
gcs().send_to_active_channels(MAVLINK_MSG_ID_BUTTON_CHANGE,
|
||||||
(const char *)&packet);
|
(const char *)&packet);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
setup the pins as input with pullup. We need pullup to give reliable
|
setup the pins as input with pullup. We need pullup to give reliable
|
||||||
|
|
Loading…
Reference in New Issue