From 846637e3e96936a73a90619c58ec42a39ae48edb Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Tue, 19 Apr 2022 13:24:28 +0900 Subject: [PATCH] AP_Button: pre-arm displays gpio vs servo_ch conflict --- libraries/AP_Button/AP_Button.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Button/AP_Button.cpp b/libraries/AP_Button/AP_Button.cpp index 449146adec..6fb4e58e98 100644 --- a/libraries/AP_Button/AP_Button.cpp +++ b/libraries/AP_Button/AP_Button.cpp @@ -388,7 +388,12 @@ bool AP_Button::arming_checks(size_t buflen, char *buffer) const } for (uint8_t i=0; ivalid_pin(pin[i])) { - hal.util->snprintf(buffer, buflen, "BTN_PIN%u %d invalid", unsigned(i + 1), int(pin[i].get())); + uint8_t servo_ch; + if (hal.gpio->pin_to_servo_channel(pin[i], servo_ch)) { + hal.util->snprintf(buffer, buflen, "BTN_PIN%u=%d, set SERVO%u_FUNCTION=-1", unsigned(i + 1), int(pin[i].get()), unsigned(servo_ch+1)); + } else { + hal.util->snprintf(buffer, buflen, "BTN_PIN%u=%d invalid", unsigned(i + 1), int(pin[i].get())); + } return false; } }