2016-02-17 21:25:59 -04:00
|
|
|
#pragma once
|
2012-04-30 04:17:14 -03:00
|
|
|
|
|
|
|
// Internal defines, don't edit and expect things to work
|
|
|
|
// -------------------------------------------------------
|
|
|
|
|
2016-08-28 09:24:32 -03:00
|
|
|
// Just so that it's completely clear...
|
2016-12-20 09:33:06 -04:00
|
|
|
#define ENABLED 1
|
|
|
|
#define DISABLED 0
|
2016-08-28 09:24:32 -03:00
|
|
|
|
|
|
|
// this avoids a very common config error
|
|
|
|
#define ENABLE ENABLED
|
|
|
|
#define DISABLE DISABLED
|
|
|
|
|
2016-12-20 09:33:06 -04:00
|
|
|
#define SERVO_MAX 4500 // This value represents 45 degrees and is just an arbitrary representation of servo max travel.
|
2012-04-30 04:17:14 -03:00
|
|
|
|
|
|
|
// CH 7 control
|
2013-02-07 18:21:22 -04:00
|
|
|
enum ch7_option {
|
2017-08-22 08:53:36 -03:00
|
|
|
CH7_DO_NOTHING = 0,
|
|
|
|
CH7_SAVE_WP = 1,
|
2017-11-30 23:15:50 -04:00
|
|
|
CH7_LEARN_CRUISE = 2,
|
2017-11-30 23:48:49 -04:00
|
|
|
CH7_ARM_DISARM = 3,
|
|
|
|
CH7_MANUAL = 4,
|
|
|
|
CH7_ACRO = 5,
|
|
|
|
CH7_STEERING = 6,
|
|
|
|
CH7_HOLD = 7,
|
|
|
|
CH7_AUTO = 8,
|
|
|
|
CH7_RTL = 9,
|
|
|
|
CH7_SMART_RTL = 10,
|
|
|
|
CH7_GUIDED = 11
|
2013-02-07 18:21:22 -04:00
|
|
|
};
|
2012-04-30 04:17:14 -03:00
|
|
|
|
|
|
|
// HIL enumerations
|
2016-12-20 09:33:06 -04:00
|
|
|
#define HIL_MODE_DISABLED 0
|
|
|
|
#define HIL_MODE_SENSORS 1
|
2012-04-30 04:17:14 -03:00
|
|
|
|
|
|
|
// Auto Pilot modes
|
|
|
|
// ----------------
|
2013-02-07 18:21:22 -04:00
|
|
|
enum mode {
|
2016-12-20 09:33:06 -04:00
|
|
|
MANUAL = 0,
|
2017-11-28 02:59:13 -04:00
|
|
|
ACRO = 1,
|
2016-12-20 09:33:06 -04:00
|
|
|
STEERING = 3,
|
|
|
|
HOLD = 4,
|
|
|
|
AUTO = 10,
|
|
|
|
RTL = 11,
|
2017-11-29 21:58:11 -04:00
|
|
|
SMART_RTL = 12,
|
2016-12-20 09:33:06 -04:00
|
|
|
GUIDED = 15,
|
|
|
|
INITIALISING = 16
|
2013-02-07 18:21:22 -04:00
|
|
|
};
|
2012-04-30 04:17:14 -03:00
|
|
|
|
2013-03-28 20:25:53 -03:00
|
|
|
// types of failsafe events
|
|
|
|
#define FAILSAFE_EVENT_THROTTLE (1<<0)
|
|
|
|
#define FAILSAFE_EVENT_GCS (1<<1)
|
|
|
|
#define FAILSAFE_EVENT_RC (1<<2)
|
|
|
|
|
2012-04-30 04:17:14 -03:00
|
|
|
// Logging parameters
|
2017-12-07 08:42:06 -04:00
|
|
|
#define LOG_THR_MSG 0x01
|
2016-12-20 09:33:06 -04:00
|
|
|
#define LOG_NTUN_MSG 0x02
|
|
|
|
#define LOG_STARTUP_MSG 0x06
|
2017-07-13 08:36:44 -03:00
|
|
|
#define LOG_RANGEFINDER_MSG 0x07
|
2015-10-30 02:56:41 -03:00
|
|
|
#define LOG_ARM_DISARM_MSG 0x08
|
2013-12-15 20:14:58 -04:00
|
|
|
#define LOG_STEERING_MSG 0x0D
|
2016-11-24 06:29:50 -04:00
|
|
|
#define LOG_GUIDEDTARGET_MSG 0x0E
|
2017-07-11 23:02:51 -03:00
|
|
|
#define LOG_WHEELENCODER_MSG 0x0F
|
2016-11-21 12:08:24 -04:00
|
|
|
#define LOG_ERROR_MSG 0x13
|
2013-04-18 21:23:57 -03:00
|
|
|
|
2016-12-20 09:33:06 -04:00
|
|
|
#define TYPE_AIRSTART_MSG 0x00
|
|
|
|
#define TYPE_GROUNDSTART_MSG 0x01
|
|
|
|
|
|
|
|
#define MASK_LOG_ATTITUDE_FAST (1<<0)
|
|
|
|
#define MASK_LOG_ATTITUDE_MED (1<<1)
|
|
|
|
#define MASK_LOG_GPS (1<<2)
|
|
|
|
#define MASK_LOG_PM (1<<3)
|
2017-12-07 08:42:06 -04:00
|
|
|
#define MASK_LOG_THR (1<<4)
|
2016-12-20 09:33:06 -04:00
|
|
|
#define MASK_LOG_NTUN (1<<5)
|
2017-10-23 21:38:52 -03:00
|
|
|
//#define MASK_LOG_MODE (1<<6) // no longer used
|
2016-12-20 09:33:06 -04:00
|
|
|
#define MASK_LOG_IMU (1<<7)
|
|
|
|
#define MASK_LOG_CMD (1<<8)
|
|
|
|
#define MASK_LOG_CURRENT (1<<9)
|
2017-07-13 08:36:44 -03:00
|
|
|
#define MASK_LOG_RANGEFINDER (1<<10)
|
2016-12-20 09:33:06 -04:00
|
|
|
#define MASK_LOG_COMPASS (1<<11)
|
|
|
|
#define MASK_LOG_CAMERA (1<<12)
|
|
|
|
#define MASK_LOG_STEERING (1<<13)
|
|
|
|
#define MASK_LOG_RC (1<<14)
|
2015-10-30 02:56:41 -03:00
|
|
|
#define MASK_LOG_ARM_DISARM (1<<15)
|
2015-05-06 23:11:43 -03:00
|
|
|
#define MASK_LOG_IMU_RAW (1UL<<19)
|
2016-08-23 03:04:30 -03:00
|
|
|
|
|
|
|
// for mavlink SET_POSITION_TARGET messages
|
2017-12-04 21:42:03 -04:00
|
|
|
#define MAVLINK_SET_POS_TYPE_MASK_POS_IGNORE ((1<<0) | (1<<1))
|
|
|
|
#define MAVLINK_SET_POS_TYPE_MASK_VEL_IGNORE ((1<<3) | (1<<4))
|
|
|
|
#define MAVLINK_SET_POS_TYPE_MASK_ACC_IGNORE ((1<<6) | (1<<7))
|
2016-08-23 03:04:30 -03:00
|
|
|
#define MAVLINK_SET_POS_TYPE_MASK_FORCE (1<<9)
|
|
|
|
#define MAVLINK_SET_POS_TYPE_MASK_YAW_IGNORE (1<<10)
|
|
|
|
#define MAVLINK_SET_POS_TYPE_MASK_YAW_RATE_IGNORE (1<<11)
|
2016-11-21 12:08:24 -04:00
|
|
|
|
2017-05-03 11:21:58 -03:00
|
|
|
// for mavlink SET_ATTITUDE_TARGET messages
|
|
|
|
#define MAVLINK_SET_ATT_TYPE_MASK_ROLL_RATE_IGNORE (1<<0)
|
|
|
|
#define MAVLINK_SET_ATT_TYPE_MASK_PITCH_RATE_IGNORE (1<<1)
|
|
|
|
#define MAVLINK_SET_ATT_TYPE_MASK_YAW_RATE_IGNORE (1<<2)
|
|
|
|
#define MAVLINK_SET_ATT_TYPE_MASK_THROTTLE_IGNORE (1<<6)
|
|
|
|
#define MAVLINK_SET_ATT_TYPE_MASK_ATTITUDE_IGNORE (1<<7)
|
|
|
|
|
2017-08-16 07:02:56 -03:00
|
|
|
// general error codes
|
|
|
|
#define ERROR_CODE_ERROR_RESOLVED 0
|
2016-11-21 12:08:24 -04:00
|
|
|
// Error message sub systems and error codes
|
2017-07-24 14:05:59 -03:00
|
|
|
#define ERROR_SUBSYSTEM_FAILSAFE_FENCE 9
|
|
|
|
#define ERROR_SUBSYSTEM_FLIGHT_MODE 10
|
|
|
|
#define ERROR_SUBSYSTEM_CRASH_CHECK 12
|
2016-11-21 12:08:24 -04:00
|
|
|
// subsystem specific error codes -- crash checker
|
2016-12-20 09:33:06 -04:00
|
|
|
#define ERROR_CODE_CRASH_CHECK_CRASH 1
|
2016-11-21 12:08:24 -04:00
|
|
|
|
|
|
|
enum fs_crash_action {
|
|
|
|
FS_CRASH_DISABLE = 0,
|
|
|
|
FS_CRASH_HOLD = 1,
|
|
|
|
FS_CRASH_HOLD_AND_DISARM = 2
|
|
|
|
};
|
|
|
|
|
2017-05-04 06:10:05 -03:00
|
|
|
#define DISTANCE_HOME_MAX 0.5f // Distance max to home location before changing it when disarm
|
2017-07-24 14:05:59 -03:00
|
|
|
|
|
|
|
enum mode_reason_t {
|
|
|
|
MODE_REASON_INITIALISED = 0,
|
|
|
|
MODE_REASON_TX_COMMAND,
|
|
|
|
MODE_REASON_GCS_COMMAND,
|
|
|
|
MODE_REASON_FAILSAFE,
|
|
|
|
MODE_REASON_MISSION_END,
|
|
|
|
MODE_REASON_CRASH_FAILSAFE,
|
2017-08-16 07:02:56 -03:00
|
|
|
MODE_REASON_MISSION_COMMAND,
|
|
|
|
MODE_REASON_FENCE_BREACH,
|
2017-07-24 14:05:59 -03:00
|
|
|
};
|
2017-08-22 04:06:23 -03:00
|
|
|
|
|
|
|
// values used by the ap.ch7_opt and ap.ch8_opt flags
|
|
|
|
enum aux_switch_pos {
|
|
|
|
AUX_SWITCH_LOW,
|
|
|
|
AUX_SWITCH_MIDDLE,
|
|
|
|
AUX_SWITCH_HIGH
|
|
|
|
};
|
|
|
|
|
2017-11-27 09:11:45 -04:00
|
|
|
enum pilot_steer_type_t {
|
|
|
|
PILOT_STEER_TYPE_DEFAULT = 0,
|
|
|
|
PILOT_STEER_TYPE_TWO_PADDLES = 1,
|
|
|
|
PILOT_STEER_TYPE_DIR_REVERSED_WHEN_REVERSING = 2,
|
|
|
|
PILOT_STEER_TYPE_DIR_UNCHANGED_WHEN_REVERSING = 3,
|
|
|
|
};
|
|
|
|
|
2017-12-06 22:37:42 -04:00
|
|
|
// frame class enum used for FRAME_CLASS parameter
|
|
|
|
enum frame_class {
|
|
|
|
FRAME_UNDEFINED = 0,
|
|
|
|
FRAME_ROVER = 1,
|
|
|
|
FRAME_BOAT = 2
|
|
|
|
};
|
|
|
|
|
2017-08-22 04:06:23 -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
|