From ff32b27272ed8f0d903d5002028f8914fdc457d6 Mon Sep 17 00:00:00 2001
From: Randy Mackay <rmackay9@yahoo.com>
Date: Thu, 3 Apr 2014 00:19:54 +0900
Subject: [PATCH] Copter: integrate parachute lib

---
 ArduCopter/APM_Config.h   |  1 +
 ArduCopter/ArduCopter.pde | 10 ++++++++++
 ArduCopter/Parameters.h   |  3 +++
 ArduCopter/Parameters.pde |  6 ++++++
 ArduCopter/config.h       |  6 ++++++
 5 files changed, 26 insertions(+)

diff --git a/ArduCopter/APM_Config.h b/ArduCopter/APM_Config.h
index f78e600a4..aed96041b 100644
--- a/ArduCopter/APM_Config.h
+++ b/ArduCopter/APM_Config.h
@@ -29,6 +29,7 @@
 //#define AC_FENCE              DISABLED            // disable fence to save 2k of flash
 //#define CAMERA                DISABLED            // disable camera trigger to save 1k of flash
 //#define CONFIG_SONAR          DISABLED            // disable sonar to save 1k of flash
+//#define PARACHUTE             DISABLED            // disable parachute release to save 1k of flash
 
 // features below are disabled by default
 //#define SPRAYER               ENABLED             // enable the crop sprayer feature (two ESC controlled pumps the speed of which depends upon the vehicle's horizontal velocity)
diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde
index 78cfb29c4..4b39a8dce 100644
--- a/ArduCopter/ArduCopter.pde
+++ b/ArduCopter/ArduCopter.pde
@@ -143,6 +143,9 @@
 #if EPM_ENABLED == ENABLED
 #include <AP_EPM.h>				// EPM cargo gripper stuff
 #endif
+#if PARACHUTE == ENABLED
+#include <AP_Parachute.h>		// Parachute release library
+#endif
 
 // AP_HAL to Arduino compatibility layer
 #include "compat.h"
@@ -712,6 +715,13 @@ static AC_Sprayer sprayer(&inertial_nav);
 static AP_EPM epm;
 #endif
 
+////////////////////////////////////////////////////////////////////////////////
+// Parachute release
+////////////////////////////////////////////////////////////////////////////////
+#if PARACHUTE == ENABLED
+static AP_Parachute parachute(relay);
+#endif
+
 ////////////////////////////////////////////////////////////////////////////////
 // function definitions to keep compiler from complaining about undeclared functions
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/ArduCopter/Parameters.h b/ArduCopter/Parameters.h
index 99c45f350..c575723c1 100644
--- a/ArduCopter/Parameters.h
+++ b/ArduCopter/Parameters.h
@@ -76,6 +76,9 @@ public:
         // GPS object
         k_param_gps,
 
+        // Parachute object
+        k_param_parachute,	// 17
+
         // Misc
         //
         k_param_log_bitmask = 20,
diff --git a/ArduCopter/Parameters.pde b/ArduCopter/Parameters.pde
index 4e87c3f86..0de5138ff 100644
--- a/ArduCopter/Parameters.pde
+++ b/ArduCopter/Parameters.pde
@@ -864,6 +864,12 @@ const AP_Param::Info var_info[] PROGMEM = {
     GOBJECT(epm,            "EPM_", AP_EPM),
 #endif
 
+#if PARACHUTE == ENABLED
+	// @Group: CHUTE_
+    // @Path: ../libraries/AP_Parachute/AP_Parachute.cpp
+    GOBJECT(parachute,		"CHUTE_", AP_Parachute),
+#endif
+
     // @Group: COMPASS_
     // @Path: ../libraries/AP_Compass/Compass.cpp
     GOBJECT(compass,        "COMPASS_", Compass),
diff --git a/ArduCopter/config.h b/ArduCopter/config.h
index 902b06e57..16661f9c9 100644
--- a/ArduCopter/config.h
+++ b/ArduCopter/config.h
@@ -404,6 +404,12 @@
  # define EPM_ENABLED DISABLED
 #endif
 
+//////////////////////////////////////////////////////////////////////////////
+// Parachute release
+#ifndef PARACHUTE
+ # define PARACHUTE ENABLED
+#endif
+
 //////////////////////////////////////////////////////////////////////////////
 // RADIO CONFIGURATION
 //////////////////////////////////////////////////////////////////////////////
-- 
GitLab