Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
autopilot_arming_throttle.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_THROTTLE_H
30 #define AUTOPILOT_ARMING_THROTTLE_H
31 
32 #include "autopilot_rc_helpers.h"
33 
34 #define AUTOPILOT_ARMING_DELAY 10
35 
43 };
44 
48 
49 static inline void autopilot_arming_init(void)
50 {
54 }
55 
56 static inline void autopilot_arming_set(bool motors_on)
57 {
58  if (motors_on) {
60  } else {
63  }
64  }
65 }
66 
74 static inline void autopilot_arming_check_motors_on(void)
75 {
76 
77  /* only allow switching motor if not in KILL mode */
79 
80  switch (autopilot_arming_state) {
81  case STATE_UNINIT:
82  autopilot_motors_on = false;
84  if (THROTTLE_STICK_DOWN()) {
86  } else {
88  }
89  break;
90  case STATE_WAITING:
91  autopilot_motors_on = false;
93  if (THROTTLE_STICK_DOWN()) {
95  }
96  break;
98  autopilot_motors_on = false;
100  if (!THROTTLE_STICK_DOWN() &&
104  }
105  break;
106  case STATE_ARMING:
107  autopilot_motors_on = false;
109  if (THROTTLE_STICK_DOWN() ||
115  }
116  break;
117  case STATE_MOTORS_ON:
118  autopilot_motors_on = true;
120  if (THROTTLE_STICK_DOWN()) {
122  }
123  break;
124  case STATE_UNARMING:
125  autopilot_motors_on = true;
127  if (!THROTTLE_STICK_DOWN()) {
129  } else if (autopilot_arming_delay_counter == 0) {
131  if (autopilot_mode != MODE_MANUAL) {
133  } else {
135  }
136  }
137  break;
138  default:
139  break;
140  }
141  }
142 
143 }
144 
145 #endif /* AUTOPILOT_ARMING_THROTTLE_H */
#define AP_MODE_KILL
Definition: autopilot.h:36
enum arming_throttle_state autopilot_arming_state
uint8_t autopilot_mode
Definition: autopilot.c:69
static void autopilot_arming_set(bool motors_on)
uint8_t autopilot_arming_delay_counter
static void autopilot_arming_check_motors_on(void)
State machine to check if motors should be turned ON or OFF.
bool autopilot_motors_on
Definition: autopilot.c:76
static bool rc_attitude_sticks_centered(void)
#define THROTTLE_STICK_DOWN()
#define AUTOPILOT_ARMING_DELAY
Some helper functions to check RC sticks.
unsigned char uint8_t
Definition: types.h:14
bool autopilot_unarmed_in_auto
static void autopilot_arming_init(void)
#define MODE_MANUAL
Default RC mode.
Definition: autopilot.h:82