Skip to content

Commit

Permalink
[fix] alternate in_flight detectors need motors_on.
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Sep 26, 2023
1 parent a0e8dfa commit bd3e8d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sw/airborne/firmwares/rotorcraft/autopilot_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool WEAK autopilot_ground_detection(void) {


/** Default end-of-in-flight detection estimation based on thrust and speed */
bool WEAK autopilot_in_flight_end_detection(void) {
bool WEAK autopilot_in_flight_end_detection(bool motors_on UNUSED) {
if (autopilot_in_flight_counter > 0) {
/* probably in_flight if thrust, speed and accel above IN_FLIGHT_MIN thresholds */
if ((stabilization_cmd[COMMAND_THRUST] <= AUTOPILOT_IN_FLIGHT_MIN_THRUST) &&
Expand Down Expand Up @@ -282,7 +282,7 @@ void autopilot_reset_in_flight_counter(void)
void autopilot_check_in_flight(bool motors_on)
{
if (autopilot.in_flight) {
if (autopilot_in_flight_end_detection()) {
if (autopilot_in_flight_end_detection(motors_on)) {
autopilot.in_flight = false;
autopilot_in_flight_counter = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/firmwares/rotorcraft/autopilot_firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern uint8_t autopilot_mode_auto2;
extern bool autopilot_ground_detection(void);

// Detect the end of in_flight and stop integrators in control loops
extern bool autopilot_in_flight_end_detection(void);
extern bool autopilot_in_flight_end_detection(bool motors_on);

extern void autopilot_firmware_init(void);

Expand Down

0 comments on commit bd3e8d0

Please sign in to comment.