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
// ------------
2012-12-08 01:23:32 -04:00
# define YAW_HOLD 0 // heading hold at heading in nav_yaw but allow input from pilot
# define YAW_ACRO 1 // pilot controlled yaw using rate controller
# define YAW_LOOK_AT_NEXT_WP 2 // point towards next waypoint (no pilot input accepted)
# define YAW_LOOK_AT_LOCATION 3 // point towards a location held in yaw_look_at_WP (no pilot input accepted)
# define YAW_LOOK_AT_HOME 4 // point towards home (no pilot input accepted)
# define YAW_LOOK_AT_HEADING 5 // point towards a particular angle (not pilot input accepted)
# define YAW_LOOK_AHEAD 6 // WARNING! CODE IN DEVELOPMENT NOT PROVEN
# define YAW_TOY 7 // THOR This is the Yaw mode
2012-06-29 18:36:42 -03:00
2011-09-04 21:15:36 -03:00
2013-02-18 01:58:24 -04:00
# define ROLL_PITCH_STABLE 0 // pilot input roll, pitch angles
# define ROLL_PITCH_ACRO 1 // pilot inputs roll, pitch rotation rates
# define ROLL_PITCH_AUTO 2 // no pilot input. autopilot roll, pitch is sent to stabilize controller inputs
# define ROLL_PITCH_STABLE_OF 3 // pilot inputs roll, pitch angles which are mixed with optical flow based position controller lean anbles
2013-01-22 23:34:49 -04:00
# define ROLL_PITCH_TOY 4 // THOR This is the Roll and Pitch mode
2013-02-18 01:58:24 -04:00
# define ROLL_PITCH_LOITER 5 // pilot inputs the desired horizontal velocities
2011-09-04 21:15:36 -03:00
2012-11-23 02:57:49 -04:00
# define THROTTLE_MANUAL 0 // manual throttle mode - pilot input goes directly to motors
# define THROTTLE_MANUAL_TILT_COMPENSATED 1 // mostly manual throttle but with some tilt compensation
# define THROTTLE_ACCELERATION 2 // pilot inputs the desired acceleration
# define THROTTLE_RATE 3 // pilot inputs the desired climb rate. Note: this uses the unstabilized rate controller
# define THROTTLE_STABILIZED_RATE 4 // pilot inputs the desired climb rate. Uses stabilized rate controller
# define THROTTLE_DIRECT_ALT 5 // pilot inputs a desired altitude from 0 ~ 10 meters
# define THROTTLE_HOLD 6 // alt hold plus pilot input of climb rate
# define THROTTLE_AUTO 7 // auto pilot altitude controller with target altitude held in next_WP.alt
# define THROTTLE_LAND 8 // landing throttle controller
2011-09-04 21:15:36 -03:00
2011-02-24 01:56:59 -04:00
// active altitude sensor
2011-03-13 03:25:38 -03:00
// ----------------------
2011-02-24 01:56:59 -04:00
# define SONAR 0
# define BARO 1
2011-11-12 23:37:16 -04:00
# define SONAR_SOURCE_ADC 1
# define SONAR_SOURCE_ANALOG_PIN 2
2011-08-05 13:22:43 -03:00
// CH 7 control
2012-12-06 04:40:36 -04:00
# define CH7_PWM_TRIGGER 1800 // pwm value above which the channel 7 option will be invoked
2012-12-19 12:08:59 -04:00
# define CH6_PWM_TRIGGER_HIGH 1800
# define CH6_PWM_TRIGGER_LOW 1200
2011-09-20 14:37:50 -03:00
# define CH7_DO_NOTHING 0
2012-12-06 04:40:36 -04:00
# define CH7_SET_HOVER 1 // deprecated
2011-09-20 14:37:50 -03:00
# define CH7_FLIP 2
# define CH7_SIMPLE_MODE 3
# define CH7_RTL 4
2012-12-06 04:40:36 -04:00
# define CH7_SAVE_TRIM 5
# define CH7_ADC_FILTER 6 // deprecated
2011-10-18 21:59:45 -03:00
# define CH7_SAVE_WP 7
2012-12-19 12:08:59 -04:00
# define CH7_MULTI_MODE 8
2012-12-06 04:40:36 -04:00
# define CH7_CAMERA_TRIGGER 9
2013-01-14 00:58:53 -04:00
# define CH7_SONAR 10 // allow enabling or disabling sonar in flight which helps avoid surface tracking when you are far above the ground
2012-08-12 02:28:13 -03:00
2011-08-05 13:22:43 -03:00
2012-12-19 12:08:59 -04:00
2011-02-24 01:56:59 -04:00
// Frame types
2011-05-18 20:38:24 -03:00
# define QUAD_FRAME 0
# define TRI_FRAME 1
2012-01-26 02:22:28 -04:00
# define HEXA_FRAME 2
2011-05-18 20:38:24 -03:00
# define Y6_FRAME 3
2011-05-23 23:14:18 -03:00
# define OCTA_FRAME 4
2011-06-12 09:14:10 -03:00
# define HELI_FRAME 5
2011-07-10 21:47:08 -03:00
# define OCTA_QUAD_FRAME 6
2011-05-18 20:38:24 -03:00
# define PLUS_FRAME 0
# define X_FRAME 1
2011-06-24 01:37:54 -03:00
# define V_FRAME 2
2011-06-16 14:03:26 -03:00
// LED output
# define NORMAL_LEDS 0
2012-11-05 00:32:38 -04:00
# define SAVE_TRIM_LEDS 1
2011-06-16 14:03:26 -03:00
2011-06-28 03:31:18 -03:00
2010-12-19 12:40:33 -04:00
// Internal defines, don't edit and expect things to work
// -------------------------------------------------------
2011-02-19 03:44:44 -04:00
# define TRUE 1
# define FALSE 0
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
2010-12-19 12:40:33 -04:00
# define DEBUG 0
2011-03-13 03:25:38 -03:00
# define LOITER_RANGE 60 // for calculating power outside of loiter radius
2010-12-19 12:40:33 -04:00
2011-02-17 03:09:13 -04:00
# define T6 1000000
# define T7 10000000
2010-12-19 12:40:33 -04:00
// GPS type codes - use the names, not the numbers
2012-08-16 21:50:03 -03:00
# define GPS_PROTOCOL_NONE -1
# define GPS_PROTOCOL_NMEA 0
# define GPS_PROTOCOL_SIRF 1
# define GPS_PROTOCOL_UBLOX 2
# define GPS_PROTOCOL_IMU 3
# define GPS_PROTOCOL_MTK 4
# define GPS_PROTOCOL_HIL 5
2012-12-21 15:19:32 -04:00
# define GPS_PROTOCOL_MTK19 6
2012-08-16 21:50:03 -03:00
# define GPS_PROTOCOL_AUTO 7
2010-12-19 12:40:33 -04:00
2011-02-19 03:44:44 -04:00
// HIL enumerations
2012-11-10 01:55:51 -04:00
# define HIL_MODE_DISABLED 0
# define HIL_MODE_ATTITUDE 1
# define HIL_MODE_SENSORS 2
2011-02-19 03:44:44 -04:00
2012-12-09 03:44:42 -04:00
// Altitude status definitions
2012-08-16 21:50:03 -03:00
# define REACHED_ALT 0
2012-11-10 01:55:51 -04:00
# define DESCENDING 1
# define ASCENDING 2
2012-01-10 19:44:26 -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 POSITION 8 // AUTO control
# define LAND 9 // AUTO control
2012-11-10 01:55:51 -04:00
# define OF_LOITER 10 // Hold a single location using optical flow
// sensor
# define TOY_A 11 // THOR Enum for Toy mode
# define TOY_M 12 // THOR Enum for Toy mode
2012-08-12 02:28:13 -03:00
# define NUM_MODES 13
2011-09-14 17:58:18 -03:00
2011-04-17 20:08:16 -03:00
// CH_6 Tuning
2011-04-18 13:27:03 -03:00
// -----------
2012-12-09 03:44:42 -04:00
# define CH6_NONE 0 // no tuning performed
# define CH6_STABILIZE_KP 1 // stabilize roll/pitch angle controller's P term
# define CH6_STABILIZE_KI 2 // stabilize roll/pitch angle controller's I term
# define CH6_STABILIZE_KD 29 // stabilize roll/pitch angle controller's D term
# define CH6_YAW_KP 3 // stabilize yaw heading controller's P term
# define CH6_YAW_KI 24 // stabilize yaw heading controller's P term
# define CH6_ACRO_KP 25 // acro controller's P term. converts pilot input to a desired roll, pitch or yaw rate
# define CH6_RATE_KP 4 // body frame roll/pitch rate controller's P term
# define CH6_RATE_KI 5 // body frame roll/pitch rate controller's I term
# define CH6_RATE_KD 21 // body frame roll/pitch rate controller's D 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_THR_HOLD_KP 14 // altitude hold controller's P term (alt error to desired rate)
# define CH6_THROTTLE_KP 7 // throttle rate controller's P term (desired rate to acceleration or motor output)
# define CH6_THROTTLE_KI 33 // throttle rate controller's I term (desired rate to acceleration or motor output)
2012-12-15 00:06:24 -04:00
# define CH6_THROTTLE_KD 37 // throttle rate controller's D term (desired rate to acceleration or motor output)
2012-12-09 03:44:42 -04:00
# define CH6_THR_ACCEL_KP 34 // accel based throttle controller's P term
# define CH6_THR_ACCEL_KI 35 // accel based throttle controller's I term
# define CH6_THR_ACCEL_KD 36 // accel based throttle controller's D term
# define CH6_TOP_BOTTOM_RATIO 8 // upper/lower motor ratio (not used)
# define CH6_RELAY 9 // switch relay on if ch6 high, off if low
# define CH6_TRAVERSE_SPEED 10 // maximum speed to next way point (0 to 10m/s)
# define CH6_NAV_KP 11 // navigation rate controller's P term (speed error to tilt angle)
# define CH6_NAV_KI 20 // navigation rate controller's I term (speed error to tilt angle)
# define CH6_LOITER_KP 12 // loiter distance controller's P term (position error to speed)
# define CH6_LOITER_KI 27 // loiter distance controller's I term (position error to speed)
# 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_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_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)
# define CH6_INAV_TC 32 // inertial navigation baro/accel and gps/accel time constant (1.5 = strong baro/gps correction on accel estimatehas very strong does not correct accel estimate, 7 = very weak correction)
2011-11-20 09:30:42 -04:00
2012-12-22 01:04:47 -04:00
// nav byte mask used with wp_verify_byte variable
// -----------------------------------------------
2011-04-18 13:27:03 -03:00
# define NAV_LOCATION 1
# define NAV_ALTITUDE 2
# define NAV_DELAY 4
2011-04-17 20:08:16 -03:00
2011-03-05 00:56:58 -04:00
2012-08-16 21:50:03 -03:00
// Commands - Note that APM now uses a subset of the MAVLink protocol
// commands. See enum MAV_CMD in the GCS_Mavlink library
# define CMD_BLANK 0 // there is no command stored in the mem location
// requested
2011-03-02 22:32:50 -04:00
# define NO_COMMAND 0
2011-03-27 18:26:34 -03:00
2013-01-24 00:36:55 -04:00
// Navigation modes held in nav_mode variable
# define NAV_NONE 0
# define NAV_CIRCLE 1
# define NAV_LOITER 2
# define NAV_WP 3
2013-01-27 10:48:07 -04:00
# define NAV_WP_INAV 5
2011-04-26 02:15:25 -03:00
2012-12-09 05:04:31 -04:00
// Yaw override behaviours - used for setting yaw_override_behaviour
# define YAW_OVERRIDE_BEHAVIOUR_AT_NEXT_WAYPOINT 0 // auto pilot takes back yaw control at next waypoint
# define YAW_OVERRIDE_BEHAVIOUR_AT_MISSION_RESTART 1 // auto pilot tkaes back control only when mission is restarted
2012-08-09 20:49:44 -03:00
// TOY mixing options
# define TOY_LOOKUP_TABLE 0
# define TOY_LINEAR_MIXER 1
# define TOY_EXTERNAL_MIXER 2
2011-04-08 16:13:31 -03:00
// Waypoint options
2012-08-16 21:50:03 -03:00
# define MASK_OPTIONS_RELATIVE_ALT 1
# 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
2012-11-29 08:08:19 -04:00
// RTL state
2012-12-17 03:17:49 -04:00
# define RTL_STATE_INITIAL_CLIMB 0
# define RTL_STATE_RETURNING_HOME 1
# define RTL_STATE_LOITERING_AT_HOME 2
# define RTL_STATE_FINAL_DESCENT 3
# define RTL_STATE_LAND 4
2012-11-29 08:08:19 -04:00
2010-12-19 12:40:33 -04:00
//repeating events
# define RELAY_TOGGLE 5
// GCS Message ID's
2011-10-11 06:12:37 -03:00
/// NOTE: to ensure we never block on sending MAVLink messages
/// please keep each MSG_ to a single MAVLink message. If need be
/// create new MSG_ IDs for additional messages on the same
/// stream
enum ap_message {
MSG_HEARTBEAT ,
MSG_ATTITUDE ,
MSG_LOCATION ,
MSG_EXTENDED_STATUS1 ,
MSG_EXTENDED_STATUS2 ,
MSG_NAV_CONTROLLER_OUTPUT ,
MSG_CURRENT_WAYPOINT ,
MSG_VFR_HUD ,
MSG_RADIO_OUT ,
MSG_RADIO_IN ,
MSG_RAW_IMU1 ,
MSG_RAW_IMU2 ,
MSG_RAW_IMU3 ,
MSG_GPS_RAW ,
MSG_SERVO_OUT ,
MSG_NEXT_WAYPOINT ,
MSG_NEXT_PARAM ,
MSG_STATUSTEXT ,
2012-07-14 23:26:17 -03:00
MSG_LIMITS_STATUS ,
2012-03-11 05:36:12 -03:00
MSG_AHRS ,
2012-03-01 08:36:35 -04:00
MSG_SIMSTATE ,
MSG_HWSTATUS ,
2011-10-11 06:12:37 -03:00
MSG_RETRY_DEFERRED // this must be last
} ;
enum gcs_severity {
SEVERITY_LOW = 1 ,
SEVERITY_MEDIUM ,
SEVERITY_HIGH ,
SEVERITY_CRITICAL
} ;
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-11 00:26:48 -03:00
# define LOG_GPS_MSG 0x02
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
2013-01-12 11:17:44 -04:00
# define LOG_IMU_MSG 0x07
2012-09-11 00:26:48 -03:00
# define LOG_CMD_MSG 0x08
2012-08-16 21:50:03 -03:00
# define LOG_CURRENT_MSG 0x09
# define LOG_STARTUP_MSG 0x0A
# define LOG_MOTORS_MSG 0x0B
# define LOG_OPTFLOW_MSG 0x0C
2013-01-12 11:17:44 -04:00
# define LOG_EVENT_MSG 0x0D
2012-08-16 21:50:03 -03:00
# define LOG_PID_MSG 0x0E
2013-02-09 02:24:02 -04:00
# define LOG_COMPASS_MSG 0x0F
2012-09-29 12:25:40 -03:00
# define LOG_DMP_MSG 0x10
2012-11-07 06:03:30 -04:00
# define LOG_INAV_MSG 0x11
2012-12-06 11:57:08 -04:00
# define LOG_CAMERA_MSG 0x12
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
2012-08-16 21:50:03 -03:00
# define LOG_INDEX_MSG 0xF0
# define MAX_NUM_LOGS 50
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)
# define MASK_LOG_MODE (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)
2012-08-16 21:50:03 -03:00
# define MASK_LOG_MOTORS (1<<10)
# define MASK_LOG_OPTFLOW (1<<11)
# define MASK_LOG_PID (1<<12)
2013-02-09 02:24:02 -04:00
# define MASK_LOG_COMPASS (1<<13)
2012-11-07 06:03:30 -04:00
# define MASK_LOG_INAV (1<<14)
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_FAST_LOOP 5
# define DATA_MED_LOOP 6
# define DATA_AP_STATE 7
# define DATA_SIMPLE_BEARING 8
# 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_DID_REACH_ALT 17
# define DATA_LAND_COMPLETE 18
# define DATA_LOST_GPS 19
# define DATA_LOST_COMPASS 20
# define DATA_BEGIN_FLIP 21
# define DATA_END_FLIP 22
# define DATA_EXIT_FLIP 23
# define DATA_FLIP_ABORTED 24
# define DATA_SET_HOME 25
# define DATA_SET_SIMPLE_ON 26
# define DATA_SET_SIMPLE_OFF 27
# define DATA_REACHED_ALT 28
# define DATA_ASCENDING 29
# define DATA_DESCENDING 30
# define DATA_RTL_REACHED_ALT 31
2012-12-09 03:44:42 -04:00
// battery monitoring macros
2013-03-03 01:13:58 -04:00
# define BATTERY_VOLTAGE(x) (x->voltage_average()*g.volt_div_ratio)
# define CURRENT_AMPS(x) (x->voltage_average()-CURR_AMPS_OFFSET)*g.curr_amp_per_volt
2011-02-24 01:56:59 -04:00
2013-03-03 10:02:36 -04:00
# define BATT_MONITOR_DISABLED 0
# define BATT_MONITOR_VOLTAGE_ONLY 3
# define BATT_MONITOR_VOLTAGE_AND_CURRENT 4
2011-05-20 14:40:11 -03:00
/* ************************************************************** */
/* Expansion PIN's that people can use for various things. */
2012-08-16 21:50:03 -03:00
// AN0 - 7 are located at edge of IMU PCB "above" pressure sensor and
// Expansion port
2011-05-20 14:40:11 -03:00
// AN0 - 5 are also located next to voltage dividers and sliding SW2 switch
2012-08-16 21:50:03 -03:00
// AN0 - 3 has 10kOhm resistor in serial, include 3.9kOhm to make it as
// voltage divider
// AN4 - 5 are direct GPIO pins from atmega1280 and they are the latest pins
// next to SW2 switch
2011-05-20 14:40:11 -03:00
// Look more ArduCopter Wiki for voltage dividers and other ports
# define AN0 54 // resistor, vdiv use, divider 1 closest to relay
# define AN1 55 // resistor, vdiv use, divider 2
# define AN2 56 // resistor, vdiv use, divider 3
# define AN3 57 // resistor, vdiv use, divider 4 closest to SW2
2012-08-16 21:50:03 -03:00
# define AN4 58 // direct GPIO pin, default as analog input, next to SW2
// switch
# define AN5 59 // direct GPIO pin, default as analog input, next to SW2
// switch
# define AN6 60 // direct GPIO pin, default as analog input, close to
// Pressure sensor, Expansion Ports
# define AN7 61 // direct GPIO pin, default as analog input, close to
// Pressure sensor, Expansion Ports
// AN8 - 15 are located at edge of IMU PCB "above" pressure sensor and
// Expansion port
// AN8 - 15 PINs are not connected anywhere, they are located as last 8 pins
// on edge of the board above Expansion Ports
// even pins (8,10,12,14) are at edge of board, Odd pins (9,11,13,15) are on
// inner row
2011-05-20 14:40:11 -03:00
# define AN8 62 // NC
# define AN9 63 // NC
# define AN10 64 // NC
# define AN11 65 // NC
# define AN12 66 // NC
# define AN13 67 // NC
# define AN14 68 // NC
# define AN15 69 // NC
2012-12-22 04:26:27 -04:00
# define RELAY_APM1_PIN 47
# define RELAY_APM2_PIN 13
2010-12-19 12:40:33 -04:00
2011-06-03 02:36:39 -03:00
# define PIEZO_PIN AN5 //Last pin on the back ADC connector
2011-11-19 15:08:03 -04:00
// RADIANS
2013-01-10 14:42:24 -04:00
# define RADX100 0.000174532925f
# define DEGX100 5729.57795f
2011-12-03 19:28:36 -04:00
2010-12-19 12:40:33 -04:00
// EEPROM addresses
2012-08-16 21:50:03 -03:00
# define EEPROM_MAX_ADDR 4096
2012-05-30 21:41:53 -03:00
// parameters get the first 1536 bytes of EEPROM, remainder is for waypoints
2012-08-16 21:50:03 -03:00
# define WP_START_BYTE 0x600 // where in memory home WP is stored + all other
// WP
2011-03-26 03:35:52 -03:00
# define WP_SIZE 15
2011-05-09 14:40:32 -03: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)
# define FENCE_START_BYTE (EEPROM_MAX_ADDR-(MAX_FENCEPOINTS*FENCE_WP_SIZE))
2012-08-16 21:50:03 -03:00
# define MAX_WAYPOINTS ((FENCE_START_BYTE - WP_START_BYTE) / WP_SIZE) - 1 // -
// 1
// to
// be
// safe
2011-10-11 06:12:37 -03:00
// mark a function as not to be inlined
# define NOINLINE __attribute__((noinline))
2011-11-12 23:37:16 -04:00
// IMU selection
2012-12-18 06:15:11 -04:00
# define CONFIG_IMU_OILPAN 1
2011-11-12 23:37:16 -04:00
# define CONFIG_IMU_MPU6000 2
2012-12-18 06:15:11 -04:00
# define CONFIG_IMU_SITL 3
2013-01-05 05:38:19 -04:00
# define CONFIG_IMU_PX4 4
2011-11-12 23:37:16 -04:00
2011-11-27 02:07:00 -04:00
# define AP_BARO_BMP085 1
# define AP_BARO_MS5611 2
2013-01-05 05:38:19 -04:00
# define AP_BARO_PX4 3
2011-11-27 02:07:00 -04:00
2013-01-08 14:25:51 -04:00
# define AP_BARO_MS5611_SPI 1
# define AP_BARO_MS5611_I2C 2
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
# define ERROR_SUBSYSTEM_FAILSAFE 5
// 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
// subsystem specific error codes -- failsafe
2012-12-31 00:32:27 -04:00
# define ERROR_CODE_FAILSAFE_THROTTLE 2
# define ERROR_CODE_FAILSAFE_BATTERY 3
# define ERROR_CODE_FAILSAFE_WATCHDOG 4
2012-12-29 23:08:25 -04:00
2011-10-11 06:12:37 -03:00
# endif // _DEFINES_H