Skip to content

Commit

Permalink
AP_Arming: add arm/disarm controlled GPIO for module power control
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwurzburg committed Nov 16, 2023
1 parent 61aec54 commit 4850114
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 15 additions & 2 deletions libraries/AP_Arming/AP_Arming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 2 additions & 0 deletions libraries/AP_Arming/AP_Arming.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ class AP_Arming {

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 {
Expand Down

0 comments on commit 4850114

Please sign in to comment.