2011-03-19 07:20:11 -03:00
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
2010-12-19 12:40:33 -04:00
2011-10-11 06:12:37 -03:00
# ifndef _DEFINES_H
# define _DEFINES_H
2012-12-13 20:32:36 -04:00
# include <AP_HAL_Boards.h>
2011-06-01 02:50:17 -03:00
// Just so that it's completely clear...
2012-08-16 21:50:03 -03:00
# define ENABLED 1
# define DISABLED 0
2011-02-24 01:56:59 -04:00
2012-03-07 03:40:04 -04:00
// this avoids a very common config error
# define ENABLE ENABLED
# define DISABLE DISABLED
2011-09-04 21:15:36 -03:00
// Flight modes
// ------------
2014-01-23 01:16:06 -04:00
# define AUTO_YAW_HOLD 0 // pilot controls the heading
# define AUTO_YAW_LOOK_AT_NEXT_WP 1 // point towards next waypoint (no pilot input accepted)
2014-02-18 08:35:29 -04:00
# define AUTO_YAW_ROI 2 // point towards a location held in roi_WP (no pilot input accepted)
2014-01-23 01:16:06 -04:00
# define AUTO_YAW_LOOK_AT_HEADING 3 // point towards a particular angle (not pilot input accepted)
# define AUTO_YAW_LOOK_AHEAD 4 // point in the direction the copter is moving
# define AUTO_YAW_RESETTOARMEDYAW 5 // point towards heading at time motors were armed
2013-07-27 20:28:00 -03:00
// Ch6, Ch7 and Ch8 aux switch control
2013-07-29 04:28:04 -03:00
# define AUX_SWITCH_PWM_TRIGGER_HIGH 1800 // pwm value above which the ch7 or ch8 option will be invoked
# define AUX_SWITCH_PWM_TRIGGER_LOW 1200 // pwm value below which the ch7 or ch8 option will be disabled
2013-05-17 02:42:28 -03:00
# define CH6_PWM_TRIGGER_HIGH 1800
# define CH6_PWM_TRIGGER_LOW 1200
# define AUX_SWITCH_DO_NOTHING 0 // aux switch disabled
# define AUX_SWITCH_SET_HOVER 1 // deprecated
# define AUX_SWITCH_FLIP 2 // flip
# define AUX_SWITCH_SIMPLE_MODE 3 // change to simple mode
# define AUX_SWITCH_RTL 4 // change to RTL flight mode
# define AUX_SWITCH_SAVE_TRIM 5 // save current position as level
# define AUX_SWITCH_ADC_FILTER 6 // deprecated
# define AUX_SWITCH_SAVE_WP 7 // save mission waypoint or RTL if in auto mode
# define AUX_SWITCH_MULTI_MODE 8 // depending upon CH6 position Flip (if ch6 is low), RTL (if ch6 in middle) or Save WP (if ch6 is high)
# define AUX_SWITCH_CAMERA_TRIGGER 9 // trigger camera servo or relay
# define AUX_SWITCH_SONAR 10 // allow enabling or disabling sonar in flight which helps avoid surface tracking when you are far above the ground
2013-07-20 03:00:08 -03:00
# define AUX_SWITCH_FENCE 11 // allow enabling or disabling fence in flight
2013-05-20 16:26:39 -03:00
# define AUX_SWITCH_RESETTOARMEDYAW 12 // changes yaw to be same as when quad was armed
2013-07-29 04:28:04 -03:00
# define AUX_SWITCH_SUPERSIMPLE_MODE 13 // change to simple mode in middle, super simple at top
2013-08-04 06:33:23 -03:00
# define AUX_SWITCH_ACRO_TRAINER 14 // low = disabled, middle = leveled, high = leveled and limited
2013-08-04 11:38:38 -03:00
# define AUX_SWITCH_SPRAYER 15 // enable/disable the crop sprayer
2013-08-19 06:09:23 -03:00
# define AUX_SWITCH_AUTO 16 // change to auto flight mode
2013-09-03 06:31:06 -03:00
# define AUX_SWITCH_AUTOTUNE 17 // auto tune
2013-10-22 01:13:36 -03:00
# define AUX_SWITCH_LAND 18 // change to LAND flight mode
2013-12-17 00:58:11 -04:00
# define AUX_SWITCH_EPM 19 // Operate the EPM cargo gripper low=off, middle=neutral, high=on
2014-01-03 21:39:08 -04:00
# define AUX_SWITCH_EKF 20 // Enable NavEKF
2014-04-02 12:20:45 -03:00
# define AUX_SWITCH_PARACHUTE_ENABLE 21 // Parachute enable/disable
# define AUX_SWITCH_PARACHUTE_RELEASE 22 // Parachute release
# define AUX_SWITCH_PARACHUTE_3POS 23 // Parachute disable, enable, release with 3 position switch
2014-05-03 15:26:58 -03:00
# define AUX_SWITCH_MISSIONRESET 24 // Reset auto mission to start from first command
2014-06-10 03:56:15 -03:00
# define AUX_SWITCH_ATTCON_FEEDFWD 25 // enable/disable the roll and pitch rate feed forward
# define AUX_SWITCH_ATTCON_ACCEL_LIM 26 // enable/disable the roll, pitch and yaw accel limiting
2014-07-10 01:00:28 -03:00
# define AUX_SWITCH_RETRACT_MOUNT 27 // Retract Mount
2011-08-05 13:22:43 -03:00
2013-07-29 04:28:04 -03:00
// values used by the ap.ch7_opt and ap.ch8_opt flags
# define AUX_SWITCH_LOW 0 // indicates auxiliar switch is in the low position (pwm <1200)
# define AUX_SWITCH_MIDDLE 1 // indicates auxiliar switch is in the middle position (pwm >1200, <1800)
# define AUX_SWITCH_HIGH 2 // indicates auxiliar switch is in the high position (pwm >1800)
2012-12-19 12:08:59 -04:00
2011-02-24 01:56:59 -04:00
// Frame types
2013-09-09 03:57:54 -03:00
# define UNDEFINED_FRAME 0
# define QUAD_FRAME 1
# define TRI_FRAME 2
# define HEXA_FRAME 3
# define Y6_FRAME 4
# define OCTA_FRAME 5
# define HELI_FRAME 6
# define OCTA_QUAD_FRAME 7
2013-11-12 09:51:48 -04:00
# define SINGLE_FRAME 8
2014-02-06 08:28:55 -04:00
# define COAX_FRAME 9
2011-05-18 20:38:24 -03:00
2010-12-19 12:40:33 -04:00
// Internal defines, don't edit and expect things to work
// -------------------------------------------------------
2012-12-19 02:02:13 -04:00
# define ToRad(x) radians(x) // *pi/180
# define ToDeg(x) degrees(x) // *180/pi
2011-02-19 03:44:44 -04:00
// HIL enumerations
2012-11-10 01:55:51 -04:00
# define HIL_MODE_DISABLED 0
2014-01-02 01:28:50 -04:00
# define HIL_MODE_SENSORS 1
2011-02-19 03:44:44 -04:00
2010-12-19 12:40:33 -04:00
// Auto Pilot modes
// ----------------
2012-08-16 21:50:03 -03:00
# define STABILIZE 0 // hold level position
# define ACRO 1 // rate control
# define ALT_HOLD 2 // AUTO control
# define AUTO 3 // AUTO control
# define GUIDED 4 // AUTO control
# define LOITER 5 // Hold a single location
# define RTL 6 // AUTO control
# define CIRCLE 7 // AUTO control
# define LAND 9 // AUTO control
2013-08-04 03:56:35 -03:00
# define OF_LOITER 10 // Hold a single location using optical flow sensor
2013-11-13 13:57:48 -04:00
# define DRIFT 11 // DRIFT mode (Note: 12 is no longer used)
2013-08-04 03:56:35 -03:00
# define SPORT 13 // earth frame rate control
2014-01-31 00:55:08 -04:00
# define FLIP 14 // flip the vehicle on the roll axis
2014-02-02 03:58:36 -04:00
# define AUTOTUNE 15 // autotune the vehicle's roll and pitch gains
2014-07-11 02:08:09 -03:00
# define POSHOLD 16 // position hold with manual override
2014-04-04 11:14:30 -03:00
# define NUM_MODES 17
2011-09-14 17:58:18 -03:00
2013-10-29 01:28:27 -03:00
2011-04-17 20:08:16 -03:00
// CH_6 Tuning
2011-04-18 13:27:03 -03:00
// -----------
2013-06-30 06:51:43 -03:00
# define CH6_NONE 0 // no tuning performed
# define CH6_STABILIZE_ROLL_PITCH_KP 1 // stabilize roll/pitch angle controller's P term
# define CH6_RATE_ROLL_PITCH_KP 4 // body frame roll/pitch rate controller's P term
# define CH6_RATE_ROLL_PITCH_KI 5 // body frame roll/pitch rate controller's I term
# define CH6_RATE_ROLL_PITCH_KD 21 // body frame roll/pitch rate controller's D term
# define CH6_STABILIZE_YAW_KP 3 // stabilize yaw heading controller's P term
# define CH6_YAW_RATE_KP 6 // body frame yaw rate controller's P term
# define CH6_YAW_RATE_KD 26 // body frame yaw rate controller's D term
# define CH6_ALTITUDE_HOLD_KP 14 // altitude hold controller's P term (alt error to desired rate)
# define CH6_THROTTLE_RATE_KP 7 // throttle rate controller's P term (desired rate to acceleration or motor output)
# define CH6_THROTTLE_ACCEL_KP 34 // accel based throttle controller's P term
# define CH6_THROTTLE_ACCEL_KI 35 // accel based throttle controller's I term
# define CH6_THROTTLE_ACCEL_KD 36 // accel based throttle controller's D term
# define CH6_LOITER_POSITION_KP 12 // loiter distance controller's P term (position error to speed)
# define CH6_LOITER_RATE_KP 22 // loiter rate controller's P term (speed error to tilt angle)
# define CH6_LOITER_RATE_KI 28 // loiter rate controller's I term (speed error to tilt angle)
# define CH6_LOITER_RATE_KD 23 // loiter rate controller's D term (speed error to tilt angle)
# define CH6_WP_SPEED 10 // maximum speed to next way point (0 to 10m/s)
2013-08-04 08:22:12 -03:00
# define CH6_ACRO_RP_KP 25 // acro controller's P term. converts pilot input to a desired roll, pitch or yaw rate
# define CH6_ACRO_YAW_KP 40 // acro controller's P term. converts pilot input to a desired roll, pitch or yaw rate
2013-06-30 06:51:43 -03:00
# define CH6_RELAY 9 // switch relay on if ch6 high, off if low
# define CH6_HELI_EXTERNAL_GYRO 13 // TradHeli specific external tail gyro gain
# define CH6_OPTFLOW_KP 17 // optical flow loiter controller's P term (position error to tilt angle)
# define CH6_OPTFLOW_KI 18 // optical flow loiter controller's I term (position error to tilt angle)
# define CH6_OPTFLOW_KD 19 // optical flow loiter controller's D term (position error to tilt angle)
# define CH6_AHRS_YAW_KP 30 // ahrs's compass effect on yaw angle (0 = very low, 1 = very high)
# define CH6_AHRS_KP 31 // accelerometer effect on roll/pitch angle (0=low)
2014-08-01 02:45:29 -03:00
# define CH6_INAV_TC 32 // deprecated -- remove
2013-06-30 06:51:43 -03:00
# define CH6_DECLINATION 38 // compass declination in radians
# define CH6_CIRCLE_RATE 39 // circle turn rate in degrees (hard coded to about 45 degrees in either direction)
2013-08-18 03:44:54 -03:00
# define CH6_SONAR_GAIN 41 // sonar gain
2014-01-06 03:40:18 -04:00
# define CH6_EKF_VERTICAL_POS 42 // EKF's baro vs accel (higher rely on accels more, baro impact is reduced). Range should be 0.2 ~ 4.0? 2.0 is default
# define CH6_EKF_HORIZONTAL_POS 43 // EKF's gps vs accel (higher rely on accels more, gps impact is reduced). Range should be 1.0 ~ 3.0? 1.5 is default
# define CH6_EKF_ACCEL_NOISE 44 // EKF's accel noise (lower means trust accels more, gps & baro less). Range should be 0.02 ~ 0.5 0.5 is default (but very robust at that level)
2014-02-19 08:59:29 -04:00
# define CH6_RC_FEEL_RP 45 // roll-pitch input smoothing
2014-05-10 09:22:06 -03:00
# define CH6_RATE_PITCH_KP 46 // body frame pitch rate controller's P term
# define CH6_RATE_PITCH_KI 47 // body frame pitch rate controller's I term
# define CH6_RATE_PITCH_KD 48 // body frame pitch rate controller's D term
# define CH6_RATE_ROLL_KP 49 // body frame roll rate controller's P term
# define CH6_RATE_ROLL_KI 50 // body frame roll rate controller's I term
# define CH6_RATE_ROLL_KD 51 // body frame roll rate controller's D term
# define CH6_RATE_PITCH_FF 52 // body frame pitch rate controller FF term
# define CH6_RATE_ROLL_FF 53 // body frame roll rate controller FF term
# define CH6_RATE_YAW_FF 54 // body frame yaw rate controller FF term
2011-11-20 09:30:42 -04:00
2013-08-04 06:14:07 -03:00
// Acro Trainer types
# define ACRO_TRAINER_DISABLED 0
# define ACRO_TRAINER_LEVELING 1
# define ACRO_TRAINER_LIMITED 2
2011-03-05 00:56:58 -04:00
2014-02-12 03:28:41 -04:00
// RC Feel roll/pitch definitions
# define RC_FEEL_RP_VERY_SOFT 0
# define RC_FEEL_RP_SOFT 25
# define RC_FEEL_RP_MEDIUM 50
# define RC_FEEL_RP_CRISP 75
# define RC_FEEL_RP_VERY_CRISP 100
2013-04-18 03:30:18 -03:00
// Yaw behaviours during missions - possible values for WP_YAW_BEHAVIOR parameter
# define WP_YAW_BEHAVIOR_NONE 0 // auto pilot will never control yaw during missions or rtl (except for DO_CONDITIONAL_YAW command received)
# define WP_YAW_BEHAVIOR_LOOK_AT_NEXT_WP 1 // auto pilot will face next waypoint or home during rtl
2013-11-13 13:57:48 -04:00
# define WP_YAW_BEHAVIOR_LOOK_AT_NEXT_WP_EXCEPT_RTL 2 // auto pilot will face next waypoint except when doing RTL at which time it will stay in it's last
2013-04-20 03:36:24 -03:00
# define WP_YAW_BEHAVIOR_LOOK_AHEAD 3 // auto pilot will look ahead during missions and rtl (primarily meant for traditional helicotpers)
2012-12-09 05:04:31 -04:00
2012-08-09 20:49:44 -03:00
2011-04-08 16:13:31 -03:00
// Waypoint options
2012-08-16 21:50:03 -03:00
# define WP_OPTION_ALT_CHANGE 2
2012-11-10 01:55:51 -04:00
# define WP_OPTION_YAW 4
2012-08-16 21:50:03 -03:00
# define WP_OPTION_ALT_REQUIRED 8
2012-11-10 01:55:51 -04:00
# define WP_OPTION_RELATIVE 16
2011-04-08 16:13:31 -03:00
//#define WP_OPTION_ 32
//#define WP_OPTION_ 64
2012-11-10 01:55:51 -04:00
# define WP_OPTION_NEXT_CMD 128
2011-04-08 16:13:31 -03:00
2014-01-27 23:21:16 -04:00
// Auto modes
enum AutoMode {
Auto_TakeOff ,
Auto_WP ,
Auto_Land ,
Auto_RTL ,
2014-04-16 04:23:24 -03:00
Auto_CircleMoveToEdge ,
2014-03-22 00:48:54 -03:00
Auto_Circle ,
2014-05-23 02:29:08 -03:00
Auto_Spline ,
Auto_NavGuided
2014-01-27 23:21:16 -04:00
} ;
2014-06-02 06:06:11 -03:00
// Guided modes
enum GuidedMode {
2014-08-04 11:08:46 -03:00
Guided_TakeOff ,
2014-06-02 06:06:11 -03:00
Guided_WP ,
Guided_Velocity
} ;
2014-01-25 04:24:43 -04:00
// RTL states
enum RTLState {
InitialClimb ,
ReturnHome ,
LoiterAtHome ,
FinalDescent ,
Land
} ;
2012-11-29 08:08:19 -04:00
2014-01-31 00:55:08 -04:00
// Flip states
enum FlipState {
Flip_Start ,
Flip_Roll ,
Flip_Recover ,
Flip_Abandon
} ;
2013-05-10 10:37:15 -03:00
// LAND state
# define LAND_STATE_FLY_TO_LOCATION 0
# define LAND_STATE_DESCENDING 1
2010-12-19 12:40:33 -04:00
// Logging parameters
2012-08-16 21:50:03 -03:00
# define TYPE_AIRSTART_MSG 0x00
2012-09-11 00:26:48 -03:00
# define TYPE_GROUNDSTART_MSG 0x01
2012-08-16 21:50:03 -03:00
# define LOG_ATTITUDE_MSG 0x01
2012-09-27 05:40:54 -03:00
# define LOG_MODE_MSG 0x03
# define LOG_CONTROL_TUNING_MSG 0x04
# define LOG_NAV_TUNING_MSG 0x05
# define LOG_PERFORMANCE_MSG 0x06
2012-08-16 21:50:03 -03:00
# define LOG_CURRENT_MSG 0x09
# define LOG_STARTUP_MSG 0x0A
# define LOG_OPTFLOW_MSG 0x0C
2013-01-12 11:17:44 -04:00
# define LOG_EVENT_MSG 0x0D
2014-01-13 04:23:09 -04:00
# define LOG_PID_MSG 0x0E // deprecated
2013-02-09 02:24:02 -04:00
# define LOG_COMPASS_MSG 0x0F
2014-01-13 09:00:11 -04:00
# define LOG_INAV_MSG 0x11 // deprecated
2014-06-10 23:55:50 -03:00
# define LOG_CAMERA_MSG_DEPRECATED 0x12 // deprecated
2012-12-29 23:08:25 -04:00
# define LOG_ERROR_MSG 0x13
2013-01-12 11:17:44 -04:00
# define LOG_DATA_INT16_MSG 0x14
# define LOG_DATA_UINT16_MSG 0x15
# define LOG_DATA_INT32_MSG 0x16
# define LOG_DATA_UINT32_MSG 0x17
# define LOG_DATA_FLOAT_MSG 0x18
2013-09-03 06:31:06 -03:00
# define LOG_AUTOTUNE_MSG 0x19
# define LOG_AUTOTUNEDETAILS_MSG 0x1A
2013-12-09 22:31:42 -04:00
# define LOG_COMPASS2_MSG 0x1B
2014-07-03 23:07:59 -03:00
# define LOG_COMPASS3_MSG 0x1C
2012-08-16 21:50:03 -03:00
2012-11-10 01:55:51 -04:00
# define MASK_LOG_ATTITUDE_FAST (1<<0)
# define MASK_LOG_ATTITUDE_MED (1<<1)
2012-08-16 21:50:03 -03:00
# define MASK_LOG_GPS (1<<2)
# define MASK_LOG_PM (1<<3)
# define MASK_LOG_CTUN (1<<4)
# define MASK_LOG_NTUN (1<<5)
2013-11-27 03:46:25 -04:00
# define MASK_LOG_RCIN (1<<6)
2013-01-12 11:17:44 -04:00
# define MASK_LOG_IMU (1<<7)
2012-08-16 21:50:03 -03:00
# define MASK_LOG_CMD (1<<8)
2013-01-26 04:20:41 -04:00
# define MASK_LOG_CURRENT (1<<9)
2013-11-27 07:17:16 -04:00
# define MASK_LOG_RCOUT (1<<10)
2012-08-16 21:50:03 -03:00
# define MASK_LOG_OPTFLOW (1<<11)
2014-01-13 04:23:09 -04:00
# define MASK_LOG_PID (1<<12) // deprecated
2013-02-09 02:24:02 -04:00
# define MASK_LOG_COMPASS (1<<13)
2014-01-13 09:00:11 -04:00
# define MASK_LOG_INAV (1<<14) // deprecated
2012-12-06 11:57:08 -04:00
# define MASK_LOG_CAMERA (1<<15)
2012-11-10 01:55:51 -04:00
// DATA - event logging
# define DATA_MAVLINK_FLOAT 1
# define DATA_MAVLINK_INT32 2
# define DATA_MAVLINK_INT16 3
# define DATA_MAVLINK_INT8 4
# define DATA_AP_STATE 7
# define DATA_INIT_SIMPLE_BEARING 9
# define DATA_ARMED 10
# define DATA_DISARMED 11
# define DATA_AUTO_ARMED 15
# define DATA_TAKEOFF 16
# define DATA_LAND_COMPLETE 18
2013-07-26 02:15:27 -03:00
# define DATA_NOT_LANDED 28
2012-11-10 01:55:51 -04:00
# define DATA_LOST_GPS 19
2014-01-31 00:55:08 -04:00
# define DATA_FLIP_START 21
# define DATA_FLIP_END 22
2012-11-10 01:55:51 -04:00
# define DATA_SET_HOME 25
# define DATA_SET_SIMPLE_ON 26
# define DATA_SET_SIMPLE_OFF 27
2013-10-19 09:53:51 -03:00
# define DATA_SET_SUPERSIMPLE_ON 29
# define DATA_AUTOTUNE_INITIALISED 30
# define DATA_AUTOTUNE_OFF 31
# define DATA_AUTOTUNE_RESTART 32
2014-02-02 03:58:36 -04:00
# define DATA_AUTOTUNE_SUCCESS 33
# define DATA_AUTOTUNE_FAILED 34
2013-10-19 09:53:51 -03:00
# define DATA_AUTOTUNE_REACHED_LIMIT 35
2014-02-02 03:58:36 -04:00
# define DATA_AUTOTUNE_PILOT_TESTING 36
2013-10-19 09:53:51 -03:00
# define DATA_AUTOTUNE_SAVEDGAINS 37
2013-10-31 23:53:16 -03:00
# define DATA_SAVE_TRIM 38
# define DATA_SAVEWP_ADD_WP 39
# define DATA_SAVEWP_CLEAR_MISSION_RTL 40
# define DATA_FENCE_ENABLE 41
# define DATA_FENCE_DISABLE 42
# define DATA_ACRO_TRAINER_DISABLED 43
# define DATA_ACRO_TRAINER_LEVELING 44
# define DATA_ACRO_TRAINER_LIMITED 45
2013-12-17 00:58:11 -04:00
# define DATA_EPM_ON 46
# define DATA_EPM_OFF 47
# define DATA_EPM_NEUTRAL 48
2014-04-03 05:55:34 -03:00
# define DATA_PARACHUTE_DISABLED 49
# define DATA_PARACHUTE_ENABLED 50
# define DATA_PARACHUTE_RELEASED 51
2014-01-26 00:41:14 -04:00
// Centi-degrees to radians
2013-01-10 14:42:24 -04:00
# define DEGX100 5729.57795f
2011-12-03 19:28:36 -04:00
2012-07-14 23:26:17 -03:00
// fence points are stored at the end of the EEPROM
2012-10-22 04:57:08 -03:00
# define MAX_FENCEPOINTS 6
2012-07-14 23:26:17 -03:00
# define FENCE_WP_SIZE sizeof(Vector2l)
2014-03-12 03:17:21 -03:00
# define FENCE_START_BYTE (HAL_STORAGE_SIZE_AVAILABLE-(MAX_FENCEPOINTS*FENCE_WP_SIZE))
2012-07-14 23:26:17 -03:00
2014-04-06 22:18:43 -03:00
// rally points shoehorned between fence points and waypoints
# define MAX_RALLYPOINTS 6
2014-04-19 02:44:38 -03:00
# define RALLY_START_BYTE (FENCE_START_BYTE-(MAX_RALLYPOINTS*AC_RALLY_WP_SIZE))
2014-04-06 22:18:43 -03:00
# define RALLY_LIMIT_KM_DEFAULT 2.0 // we'll set a per-vehicle default for this
// parameters get the first 1536 bytes of EEPROM
// mission commands are stored between these params and the rally points, or fence points if rally disabled
2014-03-12 03:17:21 -03:00
# define MISSION_START_BYTE 0x600
2014-04-06 22:18:43 -03:00
# if AC_RALLY == ENABLED
# define MISSION_END_BYTE (RALLY_START_BYTE-1)
# else
# define MISSION_END_BYTE (FENCE_START_BYTE-1)
# endif
2011-10-11 06:12:37 -03:00
// mark a function as not to be inlined
# define NOINLINE __attribute__((noinline))
2012-12-29 23:08:25 -04:00
// Error message sub systems and error codes
# define ERROR_SUBSYSTEM_MAIN 1
# define ERROR_SUBSYSTEM_RADIO 2
# define ERROR_SUBSYSTEM_COMPASS 3
# define ERROR_SUBSYSTEM_OPTFLOW 4
2013-03-16 05:14:21 -03:00
# define ERROR_SUBSYSTEM_FAILSAFE_RADIO 5
# define ERROR_SUBSYSTEM_FAILSAFE_BATT 6
# define ERROR_SUBSYSTEM_FAILSAFE_GPS 7
2013-04-29 09:30:22 -03:00
# define ERROR_SUBSYSTEM_FAILSAFE_GCS 8
# define ERROR_SUBSYSTEM_FAILSAFE_FENCE 9
2013-09-24 08:47:54 -03:00
# define ERROR_SUBSYSTEM_FLIGHT_MODE 10
2013-09-23 00:20:57 -03:00
# define ERROR_SUBSYSTEM_GPS 11
2013-10-29 10:11:48 -03:00
# define ERROR_SUBSYSTEM_CRASH_CHECK 12
2014-01-31 00:55:08 -04:00
# define ERROR_SUBSYSTEM_FLIP 13
2014-02-02 03:58:36 -04:00
# define ERROR_SUBSYSTEM_AUTOTUNE 14
2014-04-03 05:55:34 -03:00
# define ERROR_SUBSYSTEM_PARACHUTE 15
2014-07-21 07:12:17 -03:00
# define ERROR_SUBSYSTEM_EKF_CHECK 16
# define ERROR_SUBSYSTEM_FAILSAFE_EKF 17
2014-07-28 05:38:32 -03:00
# define ERROR_SUBSYSTEM_BARO 18
2012-12-29 23:08:25 -04:00
// general error codes
# define ERROR_CODE_ERROR_RESOLVED 0
# define ERROR_CODE_FAILED_TO_INITIALISE 1
// subsystem specific error codes -- radio
# define ERROR_CODE_RADIO_LATE_FRAME 2
2013-03-16 05:14:21 -03:00
// subsystem specific error codes -- failsafe_thr, batt, gps
# define ERROR_CODE_FAILSAFE_RESOLVED 0
# define ERROR_CODE_FAILSAFE_OCCURRED 1
2013-05-13 06:01:30 -03:00
// subsystem specific error codes -- compass
# define ERROR_CODE_COMPASS_FAILED_TO_READ 2
2013-09-23 00:20:57 -03:00
// subsystem specific error codes -- gps
# define ERROR_CODE_GPS_GLITCH 2
2013-10-08 03:30:43 -03:00
// subsystem specific error codes -- main
2013-10-29 10:11:48 -03:00
# define ERROR_CODE_MAIN_INS_DELAY 1
// subsystem specific error codes -- crash checker
# define ERROR_CODE_CRASH_CHECK_CRASH 1
2014-04-03 05:55:34 -03:00
# define ERROR_CODE_CRASH_CHECK_LOSS_OF_CONTROL 2
2014-01-31 00:55:08 -04:00
// subsystem specific error codes -- flip
# define ERROR_CODE_FLIP_ABANDONED 2
2014-02-02 03:58:36 -04:00
// subsystem specific error codes -- autotune
# define ERROR_CODE_AUTOTUNE_BAD_GAINS 2
2014-04-03 05:55:34 -03:00
// parachute failed to deploy because of low altitude
# define ERROR_CODE_PARACHUTE_TOO_LOW 2
2014-07-21 07:12:17 -03:00
// EKF check definitions
# define ERROR_CODE_EKF_CHECK_BAD_COMPASS 2
# define ERROR_CODE_EKF_CHECK_BAD_COMPASS_CLEARED 0
2014-07-28 05:38:32 -03:00
// Baro specific error codes
# define ERROR_CODE_BARO_GLITCH 2
2012-12-29 23:08:25 -04:00
2013-11-15 04:12:31 -04:00
// Arming Check Enable/Disable bits
# define ARMING_CHECK_NONE 0x00
# define ARMING_CHECK_ALL 0x01
# define ARMING_CHECK_BARO 0x02
# define ARMING_CHECK_COMPASS 0x04
# define ARMING_CHECK_GPS 0x08
# define ARMING_CHECK_INS 0x10
# define ARMING_CHECK_PARAMETERS 0x20
# define ARMING_CHECK_RC 0x40
# define ARMING_CHECK_VOLTAGE 0x80
2012-12-29 23:08:25 -04:00
2013-11-16 00:55:59 -04:00
// Radio failsafe definitions (FS_THR parameter)
# define FS_THR_DISABLED 0
# define FS_THR_ENABLED_ALWAYS_RTL 1
# define FS_THR_ENABLED_CONTINUE_MISSION 2
# define FS_THR_ENABLED_ALWAYS_LAND 3
2013-11-16 01:46:57 -04:00
// Battery failsafe definitions (FS_BATT_ENABLE parameter)
# define FS_BATT_DISABLED 0 // battery failsafe disabled
# define FS_BATT_LAND 1 // switch to LAND mode on battery failsafe
# define FS_BATT_RTL 2 // switch to RTL mode on battery failsafe
2013-11-16 00:55:59 -04:00
// GPS Failsafe definitions (FS_GPS_ENABLE parameter)
# define FS_GPS_DISABLED 0 // GPS failsafe disabled
# define FS_GPS_LAND 1 // switch to LAND mode on GPS Failsafe
# define FS_GPS_ALTHOLD 2 // switch to ALTHOLD mode on GPS failsafe
# define FS_GPS_LAND_EVEN_STABILIZE 3 // switch to LAND mode on GPS failsafe even if in a manual flight mode like Stabilize
2014-07-28 19:25:40 -03:00
2014-07-30 01:49:10 -03:00
enum Serial2Protocol {
SERIAL2_MAVLINK = 1 ,
SERIAL2_FRSKY_DPORT = 2 ,
SERIAL2_FRSKY_SPORT = 3 // not supported yet
2014-07-28 19:25:40 -03:00
} ;
2011-10-11 06:12:37 -03:00
# endif // _DEFINES_H