From ae287381ba94d031533351c926391fdf99e4de4f Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Tue, 19 Apr 2022 11:18:44 +0900 Subject: [PATCH] AP_RPM: pre-arm displays gpio vs servo_ch conflict --- libraries/AP_RPM/AP_RPM.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/AP_RPM/AP_RPM.cpp b/libraries/AP_RPM/AP_RPM.cpp index 0b86a22b47..d59c02a360 100644 --- a/libraries/AP_RPM/AP_RPM.cpp +++ b/libraries/AP_RPM/AP_RPM.cpp @@ -246,11 +246,16 @@ bool AP_RPM::arming_checks(size_t buflen, char *buffer) const case RPM_TYPE_PWM: case RPM_TYPE_PIN: if (_params[i].pin == -1) { - hal.util->snprintf(buffer, buflen, "RPM[%u] no pin set", i + 1); + hal.util->snprintf(buffer, buflen, "RPM%u_PIN not set", unsigned(i + 1)); return false; } if (!hal.gpio->valid_pin(_params[i].pin)) { - hal.util->snprintf(buffer, buflen, "RPM[%u] pin %d invalid", unsigned(i + 1), int(_params[i].pin.get())); + uint8_t servo_ch; + if (hal.gpio->pin_to_servo_channel(_params[i].pin, servo_ch)) { + hal.util->snprintf(buffer, buflen, "RPM%u_PIN=%d, set SERVO%u_FUNCTION=-1", unsigned(i + 1), int(_params[i].pin.get()), unsigned(servo_ch+1)); + } else { + hal.util->snprintf(buffer, buflen, "RPM%u_PIN=%d invalid", unsigned(i + 1), int(_params[i].pin.get())); + } return false; } break;