Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Sep 25, 2023
1 parent 043c21a commit 41a2b4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions sw/airborne/firmwares/rotorcraft/autopilot_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static uint32_t autopilot_in_flight_counter;
#endif

/** Default ground-detection estimation based on accelerometer shock */
__attribute__((weak)) bool autopilot_ground_detection(void) {
bool WEAK autopilot_ground_detection(void) {
struct NedCoor_f *accel = stateGetAccelNed_f();
if (accel->z < -THRESHOLD_GROUND_DETECT ||
accel->z > THRESHOLD_GROUND_DETECT) {
Expand All @@ -89,7 +89,7 @@ __attribute__((weak)) bool autopilot_ground_detection(void) {


/** Default in-flight detection estimation based on thrust and speed */
__attribute__((weak)) bool autopilot_in_flight_detection(void) {
bool WEAK autopilot_in_flight_end_detection(void) {
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,9 +282,9 @@ void autopilot_reset_in_flight_counter(void)
void autopilot_check_in_flight(bool motors_on)
{
if (autopilot.in_flight) {
if (autopilot_in_flight_detection()) {
if (autopilot_in_flight_end_detection()) {
autopilot.in_flight = false;
autopilot_in_flight_counter == 0;
autopilot_in_flight_counter = 0;
}
} else { /* currently not in flight */
if (autopilot_in_flight_counter < AUTOPILOT_IN_FLIGHT_TIME &&
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/firmwares/rotorcraft/autopilot_firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
extern uint8_t autopilot_mode_auto2;

// Detect the ground and set NavGroundDetect() to true
__attribute__((weak)) extern bool autopilot_ground_detection(void);
extern bool autopilot_ground_detection(void);

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

extern void autopilot_firmware_init(void);

Expand Down

0 comments on commit 41a2b4b

Please sign in to comment.