Skip to content

Commit

Permalink
[rotorcraft] rename autopilot_detect_ground to autopilot_ground_detected
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Sep 5, 2013
1 parent cecb952 commit d2e05e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions sw/airborne/firmwares/rotorcraft/autopilot.c
Expand Up @@ -49,7 +49,7 @@ bool_t kill_throttle;
bool_t autopilot_rc;
bool_t autopilot_power_switch;

bool_t autopilot_detect_ground;
bool_t autopilot_ground_detected;
bool_t autopilot_detect_ground_once;

#define AUTOPILOT_IN_FLIGHT_TIME 20
Expand Down Expand Up @@ -105,7 +105,7 @@ void autopilot_init(void) {
autopilot_in_flight = FALSE;
autopilot_in_flight_counter = 0;
autopilot_mode_auto2 = MODE_AUTO2;
autopilot_detect_ground = FALSE;
autopilot_ground_detected = FALSE;
autopilot_detect_ground_once = FALSE;
autopilot_flight_time = 0;
autopilot_rc = TRUE;
Expand All @@ -131,9 +131,9 @@ void autopilot_periodic(void) {
RunOnceEvery(NAV_PRESCALER, nav_periodic_task());
#if FAILSAFE_GROUND_DETECT
INFO("Using FAILSAFE_GROUND_DETECT")
if (autopilot_mode == AP_MODE_FAILSAFE && autopilot_detect_ground) {
if (autopilot_mode == AP_MODE_FAILSAFE && autopilot_ground_detected) {
autopilot_set_mode(AP_MODE_KILL);
autopilot_detect_ground = FALSE;
autopilot_ground_detected = FALSE;
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/firmwares/rotorcraft/autopilot.h
Expand Up @@ -69,7 +69,7 @@ extern void autopilot_set_mode(uint8_t new_autopilot_mode);
extern void autopilot_set_motors_on(bool_t motors_on);
extern void autopilot_check_in_flight(bool_t motors_on);

extern bool_t autopilot_detect_ground;
extern bool_t autopilot_ground_detected;
extern bool_t autopilot_detect_ground_once;

extern uint16_t autopilot_flight_time;
Expand Down Expand Up @@ -152,7 +152,7 @@ static inline void DetectGroundEvent(void) {
struct NedCoor_f* accel = stateGetAccelNed_f();
if (accel->z < -THRESHOLD_GROUND_DETECT ||
accel->z > THRESHOLD_GROUND_DETECT) {
autopilot_detect_ground = TRUE;
autopilot_ground_detected = TRUE;
autopilot_detect_ground_once = FALSE;
}
}
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/firmwares/rotorcraft/navigation.c
Expand Up @@ -336,8 +336,8 @@ void navigation_update_wp_from_speed(uint8_t wp, struct Int16Vect3 speed_sp, int
}

bool_t nav_detect_ground(void) {
if (!autopilot_detect_ground) return FALSE;
autopilot_detect_ground = FALSE;
if (!autopilot_ground_detected) return FALSE;
autopilot_ground_detected = FALSE;
return TRUE;
}

Expand Down

0 comments on commit d2e05e5

Please sign in to comment.