Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros 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 
22 #ifndef AUTOPILOT_ARMING_YAW_H
23 #define AUTOPILOT_ARMING_YAW_H
24 
25 #include "autopilot_rc_helpers.h"
26 
27 
28 #define AUTOPILOT_MOTOR_ON_TIME 40
29 
30 // Motors ON check state machine
38 };
39 
42 
43 
44 static inline void autopilot_arming_init(void) {
47 }
48 
49 
52 static inline void autopilot_arming_set(bool_t motors_on) {
53  if (motors_on)
55  else
57 }
58 
65 static inline void autopilot_arming_check_motors_on( void ) {
66  /* only allow switching motor if not in FAILSAFE or KILL mode */
68 
70  case STATUS_MOTORS_OFF:
73  if (THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED()) // stick pushed
75  break;
81  else if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) // stick released too soon
83  break;
87  if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) // wait until stick released
89  break;
90  case STATUS_MOTORS_ON:
93  if (THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED()) // stick pushed
95  break;
101  else if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) // stick released too soon
103  break;
104  case STATUS_STOP_MOTORS:
107  if (!(THROTTLE_STICK_DOWN() && YAW_STICK_PUSHED())) // wait until stick released
109  break;
110  default:
111  break;
112  };
113  }
114 }
115 
116 #endif /* AUTOPILOT_ARMING_YAW_H */
uint32_t autopilot_motors_on_counter
uint8_t autopilot_mode
Definition: autopilot.c:31
#define AP_MODE_KILL
Definition: autopilot.h:33
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 FALSE
Definition: imu_chimu.h:141
bool_t autopilot_motors_on
Definition: autopilot.c:38
#define YAW_STICK_PUSHED()
#define AUTOPILOT_MOTOR_ON_TIME
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
static void autopilot_arming_init(void)