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
|
|
|
|
|
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-08-16 21:50:03 -03:00
|
|
|
#define YAW_HOLD 0
|
|
|
|
#define YAW_ACRO 1
|
|
|
|
#define YAW_AUTO 2
|
2012-10-18 17:39:05 -03:00
|
|
|
#define YAW_LOOK_AT_HOME 3
|
2012-08-16 21:50:03 -03:00
|
|
|
#define YAW_TOY 4 // THOR This is the Yaw mode
|
2012-06-29 18:36:42 -03:00
|
|
|
|
2011-09-04 21:15:36 -03:00
|
|
|
|
2012-08-16 21:50:03 -03:00
|
|
|
#define ROLL_PITCH_STABLE 0
|
|
|
|
#define ROLL_PITCH_ACRO 1
|
|
|
|
#define ROLL_PITCH_AUTO 2
|
|
|
|
#define ROLL_PITCH_STABLE_OF 3
|
|
|
|
#define ROLL_PITCH_TOY 4 // THOR This is the Roll and Pitch
|
|
|
|
// mode
|
2011-09-04 21:15:36 -03:00
|
|
|
|
2012-08-16 21:50:03 -03:00
|
|
|
#define THROTTLE_MANUAL 0
|
|
|
|
#define THROTTLE_HOLD 1
|
|
|
|
#define THROTTLE_AUTO 2
|
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
|
2011-09-20 14:37:50 -03:00
|
|
|
#define CH7_DO_NOTHING 0
|
|
|
|
#define CH7_SET_HOVER 1
|
|
|
|
#define CH7_FLIP 2
|
|
|
|
#define CH7_SIMPLE_MODE 3
|
|
|
|
#define CH7_RTL 4
|
2011-09-22 02:31:12 -03:00
|
|
|
#define CH7_AUTO_TRIM 5
|
2011-09-30 03:27:23 -03:00
|
|
|
#define CH7_ADC_FILTER 6
|
2011-10-18 21:59:45 -03:00
|
|
|
#define CH7_SAVE_WP 7
|
2012-08-12 02:28:13 -03:00
|
|
|
#define CH7_MULTI_MODE 8
|
|
|
|
|
2011-08-05 13:22:43 -03: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
|
|
|
|
2012-08-09 20:49:44 -03:00
|
|
|
#define CH_7_PWM_TRIGGER 1800
|
2012-08-12 02:28:13 -03:00
|
|
|
#define CH_6_PWM_TRIGGER_HIGH 1800
|
2012-08-09 20:49:44 -03:00
|
|
|
#define CH_6_PWM_TRIGGER 1500
|
2012-08-12 02:28:13 -03:00
|
|
|
#define CH_6_PWM_TRIGGER_LOW 1200
|
2012-08-09 20:49:44 -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-08-16 21:50:03 -03:00
|
|
|
#define ToRad(x) (x*0.01745329252) // *pi/180
|
|
|
|
#define ToDeg(x) (x*57.2957795131) // *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
|
|
|
|
#define GPS_PROTOCOL_MTK16 6
|
|
|
|
#define GPS_PROTOCOL_AUTO 7
|
2010-12-19 12:40:33 -04:00
|
|
|
|
|
|
|
#define CH_ROLL CH_1
|
|
|
|
#define CH_PITCH CH_2
|
|
|
|
#define CH_THROTTLE CH_3
|
|
|
|
#define CH_RUDDER CH_4
|
|
|
|
#define CH_YAW CH_4
|
|
|
|
|
2011-05-05 14:47:11 -03:00
|
|
|
#define RC_CHANNEL_ANGLE 0
|
|
|
|
#define RC_CHANNEL_RANGE 1
|
|
|
|
#define RC_CHANNEL_ANGLE_RAW 2
|
|
|
|
|
2011-02-19 03:44:44 -04:00
|
|
|
// HIL enumerations
|
2012-08-16 21:50:03 -03: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-08-16 21:50:03 -03:00
|
|
|
#define ASCENDING 1
|
|
|
|
#define DESCENDING -1
|
|
|
|
#define REACHED_ALT 0
|
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
|
|
|
|
#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
|
|
|
|
|
|
|
#define SIMPLE_1 1
|
|
|
|
#define SIMPLE_2 2
|
|
|
|
#define SIMPLE_3 4
|
|
|
|
#define SIMPLE_4 8
|
|
|
|
#define SIMPLE_5 16
|
|
|
|
#define SIMPLE_6 32
|
2010-12-19 12:40:33 -04:00
|
|
|
|
2011-04-17 20:08:16 -03:00
|
|
|
// CH_6 Tuning
|
2011-04-18 13:27:03 -03:00
|
|
|
// -----------
|
2011-04-17 20:08:16 -03:00
|
|
|
#define CH6_NONE 0
|
2011-07-10 21:47:08 -03:00
|
|
|
// Attitude
|
|
|
|
#define CH6_STABILIZE_KP 1
|
|
|
|
#define CH6_STABILIZE_KI 2
|
2012-08-16 21:50:03 -03:00
|
|
|
#define CH6_STABILIZE_KD 29 // duplicate with CH6_DAMP
|
2012-03-28 11:58:58 -03:00
|
|
|
#define CH6_YAW_KP 3
|
|
|
|
#define CH6_YAW_KI 24
|
2011-07-10 21:47:08 -03:00
|
|
|
// Rate
|
2012-03-28 11:58:58 -03:00
|
|
|
#define CH6_ACRO_KP 25
|
2011-09-10 20:25:52 -03:00
|
|
|
#define CH6_RATE_KP 4
|
|
|
|
#define CH6_RATE_KI 5
|
2012-02-17 19:20:39 -04:00
|
|
|
#define CH6_RATE_KD 21
|
2012-03-28 11:58:58 -03:00
|
|
|
#define CH6_YAW_RATE_KP 6
|
|
|
|
#define CH6_YAW_RATE_KD 26
|
2011-11-20 09:30:42 -04:00
|
|
|
// Altitude rate controller
|
2011-09-10 20:25:52 -03:00
|
|
|
#define CH6_THROTTLE_KP 7
|
2011-07-10 21:47:08 -03:00
|
|
|
// Extras
|
2011-09-10 20:25:52 -03:00
|
|
|
#define CH6_TOP_BOTTOM_RATIO 8
|
|
|
|
#define CH6_RELAY 9
|
2012-03-28 11:58:58 -03:00
|
|
|
// Navigation
|
2012-08-16 21:50:03 -03:00
|
|
|
#define CH6_TRAVERSE_SPEED 10 // maximum speed to next way point
|
2012-03-28 11:58:58 -03:00
|
|
|
#define CH6_NAV_KP 11
|
|
|
|
#define CH6_LOITER_KP 12
|
|
|
|
#define CH6_LOITER_KI 27
|
2011-04-17 20:08:16 -03:00
|
|
|
|
2012-03-28 11:58:58 -03:00
|
|
|
// Trad Heli specific
|
2011-10-29 08:34:21 -03:00
|
|
|
#define CH6_HELI_EXTERNAL_GYRO 13
|
2011-09-10 22:37:28 -03:00
|
|
|
|
2011-11-20 09:30:42 -04:00
|
|
|
// altitude controller
|
|
|
|
#define CH6_THR_HOLD_KP 14
|
2011-12-23 18:24:17 -04:00
|
|
|
#define CH6_Z_GAIN 15
|
2012-08-16 21:50:03 -03:00
|
|
|
#define CH6_DAMP 16 // duplicate with CH6_YAW_RATE_KD
|
2011-12-23 18:24:17 -04:00
|
|
|
|
2012-01-09 00:53:54 -04:00
|
|
|
// optical flow controller
|
|
|
|
#define CH6_OPTFLOW_KP 17
|
|
|
|
#define CH6_OPTFLOW_KI 18
|
2012-01-25 08:55:14 -04:00
|
|
|
#define CH6_OPTFLOW_KD 19
|
2012-01-09 00:53:54 -04:00
|
|
|
|
2012-01-31 00:55:05 -04:00
|
|
|
#define CH6_NAV_I 20
|
2012-03-28 11:58:58 -03:00
|
|
|
#define CH6_LOITER_RATE_KP 22
|
|
|
|
#define CH6_LOITER_RATE_KI 28
|
|
|
|
#define CH6_LOITER_RATE_KD 23
|
2012-01-31 00:55:05 -04:00
|
|
|
|
2012-08-16 21:50:03 -03:00
|
|
|
#define CH6_AHRS_YAW_KP 30
|
|
|
|
#define CH6_AHRS_KP 31
|
2012-04-16 11:47:57 -03:00
|
|
|
|
2012-11-07 06:03:30 -04:00
|
|
|
// Inertial Nav
|
|
|
|
#define CH6_INAV_TC 32
|
2011-11-20 09:30:42 -04:00
|
|
|
|
2011-04-18 13:27:03 -03:00
|
|
|
// nav byte mask
|
|
|
|
// -------------
|
|
|
|
#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
|
|
|
|
2011-04-26 02:15:25 -03:00
|
|
|
#define LOITER_MODE 1
|
|
|
|
#define WP_MODE 2
|
2011-09-21 17:19:36 -03:00
|
|
|
#define CIRCLE_MODE 3
|
2011-12-15 02:08:21 -04:00
|
|
|
#define NO_NAV_MODE 4
|
2012-08-16 21:50:03 -03:00
|
|
|
#define TOY_MODE 5 // THOR This mode defines the Virtual
|
|
|
|
// WP following mode
|
2011-04-26 02:15:25 -03:00
|
|
|
|
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
|
|
|
|
#define WP_OPTION_YAW 4
|
|
|
|
#define WP_OPTION_ALT_REQUIRED 8
|
|
|
|
#define WP_OPTION_RELATIVE 16
|
2011-04-08 16:13:31 -03:00
|
|
|
//#define WP_OPTION_ 32
|
|
|
|
//#define WP_OPTION_ 64
|
2012-08-16 21:50:03 -03:00
|
|
|
#define WP_OPTION_NEXT_CMD 128
|
2011-04-08 16:13:31 -03:00
|
|
|
|
2010-12-19 12:40:33 -04:00
|
|
|
//repeating events
|
|
|
|
#define NO_REPEAT 0
|
2011-03-13 03:25:38 -03:00
|
|
|
#define CH_5_TOGGLE 1
|
|
|
|
#define CH_6_TOGGLE 2
|
|
|
|
#define CH_7_TOGGLE 3
|
|
|
|
#define CH_8_TOGGLE 4
|
2010-12-19 12:40:33 -04:00
|
|
|
#define RELAY_TOGGLE 5
|
|
|
|
#define STOP_REPEAT 10
|
|
|
|
|
|
|
|
// 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_STATUS,
|
|
|
|
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
|
2012-09-11 00:26:48 -03:00
|
|
|
#define LOG_RAW_MSG 0x07
|
|
|
|
#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
|
|
|
|
#define LOG_DATA_MSG 0x0D
|
|
|
|
#define LOG_PID_MSG 0x0E
|
2012-09-11 00:26:48 -03:00
|
|
|
#define LOG_ITERM_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-08-16 21:50:03 -03:00
|
|
|
#define LOG_INDEX_MSG 0xF0
|
|
|
|
#define MAX_NUM_LOGS 50
|
|
|
|
|
|
|
|
#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)
|
|
|
|
#define MASK_LOG_CTUN (1<<4)
|
|
|
|
#define MASK_LOG_NTUN (1<<5)
|
|
|
|
#define MASK_LOG_MODE (1<<6)
|
|
|
|
#define MASK_LOG_RAW (1<<7)
|
|
|
|
#define MASK_LOG_CMD (1<<8)
|
|
|
|
#define MASK_LOG_CUR (1<<9)
|
|
|
|
#define MASK_LOG_MOTORS (1<<10)
|
|
|
|
#define MASK_LOG_OPTFLOW (1<<11)
|
|
|
|
#define MASK_LOG_PID (1<<12)
|
2012-09-11 00:26:48 -03:00
|
|
|
#define MASK_LOG_ITERM (1<<13)
|
2012-11-07 06:03:30 -04:00
|
|
|
#define MASK_LOG_INAV (1<<14)
|
2012-09-11 00:26:48 -03:00
|
|
|
|
2010-12-19 12:40:33 -04:00
|
|
|
|
|
|
|
// Waypoint Modes
|
|
|
|
// ----------------
|
|
|
|
#define ABS_WP 0
|
|
|
|
#define REL_WP 1
|
|
|
|
|
|
|
|
// Command Queues
|
|
|
|
// ---------------
|
|
|
|
#define COMMAND_MUST 0
|
2011-02-17 05:36:33 -04:00
|
|
|
#define COMMAND_MAY 1
|
|
|
|
#define COMMAND_NOW 2
|
2010-12-19 12:40:33 -04:00
|
|
|
|
|
|
|
// Events
|
|
|
|
// ------
|
|
|
|
#define EVENT_WILL_REACH_WAYPOINT 1
|
|
|
|
#define EVENT_SET_NEW_WAYPOINT_INDEX 2
|
|
|
|
#define EVENT_LOADED_WAYPOINT 3
|
|
|
|
#define EVENT_LOOP 4
|
|
|
|
|
2011-02-24 01:56:59 -04:00
|
|
|
// Climb rate calculations
|
2012-08-16 21:50:03 -03:00
|
|
|
#define ALTITUDE_HISTORY_LENGTH 8 //Number of (time,altitude) points to
|
|
|
|
// regress a climb rate from
|
2011-02-24 01:56:59 -04:00
|
|
|
|
2012-01-20 18:29:09 -04:00
|
|
|
#define BATTERY_VOLTAGE(x) (x*(g.input_voltage/1024.0))*g.volt_div_ratio
|
|
|
|
#define CURRENT_AMPS(x) ((x*(g.input_voltage/1024.0))-CURR_AMPS_OFFSET)*g.curr_amp_per_volt
|
2011-02-24 01:56:59 -04:00
|
|
|
|
2011-09-04 21:15:36 -03:00
|
|
|
//#define BARO_FILTER_SIZE 8
|
2011-01-16 23:44:12 -04:00
|
|
|
|
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
|
|
|
|
|
2010-12-19 12:40:33 -04:00
|
|
|
#define RELAY_PIN 47
|
|
|
|
|
2011-06-03 02:36:39 -03:00
|
|
|
#define PIEZO_PIN AN5 //Last pin on the back ADC connector
|
|
|
|
|
|
|
|
|
2011-06-16 14:03:26 -03:00
|
|
|
|
|
|
|
// sonar
|
2011-09-04 21:15:36 -03:00
|
|
|
//#define SonarToCm(x) (x*1.26) // Sonar raw value to centimeters
|
2011-06-16 14:03:26 -03:00
|
|
|
|
2011-11-19 15:08:03 -04:00
|
|
|
// RADIANS
|
2011-12-03 19:28:36 -04:00
|
|
|
#define RADX100 0.000174532925
|
|
|
|
#define DEGX100 5729.57795
|
|
|
|
|
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
|
|
|
|
2011-04-15 10:24:05 -03:00
|
|
|
#define ONBOARD_PARAM_NAME_LENGTH 15
|
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
|
|
|
|
#define CONFIG_IMU_OILPAN 1
|
|
|
|
#define CONFIG_IMU_MPU6000 2
|
|
|
|
|
|
|
|
// APM Hardware selection
|
|
|
|
#define APM_HARDWARE_APM1 1
|
2011-11-25 19:11:25 -04:00
|
|
|
#define APM_HARDWARE_APM2 2
|
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
|
|
|
|
|
2011-12-20 01:04:51 -04:00
|
|
|
#define LOGGING_SIMPLE 1
|
|
|
|
#define LOGGING_VERBOSE 2
|
|
|
|
|
2012-02-11 19:53:09 -04:00
|
|
|
// Channel Config selection
|
|
|
|
|
|
|
|
#define CHANNEL_CONFIG_DEFAULT 1
|
|
|
|
#define CHANNEL_CONFIG_CUSTOM 2
|
|
|
|
|
2011-10-11 06:12:37 -03:00
|
|
|
#endif // _DEFINES_H
|