AP_Arming: add arm/disarm controlled GPIO for module power control

This commit is contained in:
Henry Wurzburg 2023-11-16 16:04:20 -06:00 committed by Andrew Tridgell
parent afa263c691
commit fffe3afb28
2 changed files with 17 additions and 2 deletions

View File

@ -1681,7 +1681,9 @@ bool AP_Arming::arm(AP_Arming::Method method, const bool do_arming_checks)
}
}
#endif
#if defined(HAL_ARM_GPIO_PIN)
update_arm_gpio();
#endif
return armed;
}
@ -1721,10 +1723,21 @@ bool AP_Arming::disarm(const AP_Arming::Method method, bool do_disarm_checks)
}
}
#endif
#if defined(HAL_ARM_GPIO_PIN)
update_arm_gpio();
#endif
return true;
}
#if defined(HAL_ARM_GPIO_PIN)
void AP_Arming::update_arm_gpio()
{
if (!AP_BoardConfig::arming_gpio_disabled()) {
hal.gpio->write(HAL_ARM_GPIO_PIN, HAL_ARM_GPIO_POL_INVERT ? !armed : armed);
}
}
#endif
void AP_Arming::send_arm_disarm_statustext(const char *str) const
{
if (option_enabled(AP_Arming::Option::DISABLE_STATUSTEXT_ON_STATE_CHANGE)) {

View File

@ -303,6 +303,8 @@ private:
uint32_t last_prearm_display_ms; // last time we send statustexts for prearm failures
bool running_arming_checks; // true if the arming checks currently being performed are being done because the vehicle is trying to arm the vehicle
void update_arm_gpio();
};
namespace AP {