Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
autopilot_arming_yaw.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
29 #ifndef AUTOPILOT_ARMING_YAW_H
30 #define AUTOPILOT_ARMING_YAW_H
31 
32 #include "autopilot_rc_helpers.h"
33 
38 #ifndef MOTOR_ARMING_DELAY
39 #define MOTOR_ARMING_DELAY 40
40 #endif
41 
50 };
51 
54 
55 
56 static inline void autopilot_arming_init(void) {
59 }
60 
61 
64 static inline void autopilot_arming_set(bool_t motors_on) {
65  if (motors_on)
67  else
69 }
70 
77 static inline void autopilot_arming_check_motors_on( void ) {
78  /* only allow switching motor if not in FAILSAFE or KILL mode */
80 
82  case STATUS_MOTORS_OFF:
85  if (THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED()) // stick pushed
87  break;
93  else if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) // stick released too soon
95  break;
99  if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) // wait until stick released
101  break;
102  case STATUS_MOTORS_ON:
105  if (THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED()) // stick pushed
107  break;
113  else if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) // stick released too soon
115  break;
116  case STATUS_STOP_MOTORS:
119  if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) // wait until stick released
121  break;
122  default:
123  break;
124  };
125  }
126 }
127 
128 #endif /* AUTOPILOT_ARMING_YAW_H */
uint32_t autopilot_motors_on_counter
#define AP_MODE_KILL
Definition: autopilot.h:39
uint8_t autopilot_mode
Definition: autopilot.c:47
bool_t autopilot_motors_on
Definition: autopilot.c:54
static void autopilot_arming_set(bool_t motors_on)
Update the status of the check_motors state machine.
enum arming_state autopilot_check_motor_status
#define THROTTLE_STICK_DOWN()
#define MOTOR_ARMING_DELAY
Delay until motors are armed/disarmed.
#define FALSE
Definition: imu_chimu.h:141
#define YAW_STICK_PUSHED()
unsigned long uint32_t
Definition: types.h:18
static void autopilot_arming_check_motors_on(void)
State machine to check if motors should be turned ON or OFF.
#define TRUE
Definition: imu_chimu.h:144
Some helper functions to check RC sticks.
#define AP_MODE_FAILSAFE
Definition: autopilot.h:40
static void autopilot_arming_init(void)