most functionality to splashdwon, find neutral and start mission. short timeouts still in code for testing, will adjust to go directly to sit_idle after splashdown

Dependencies:   mbed MODSERIAL FATFileSystem

Revision:
10:085ab7328054
Parent:
9:d5fcdcb3c89d
Child:
14:85b64a4d08e8
--- a/omegaPX209/omegaPX209.cpp	Fri Oct 20 11:41:22 2017 +0000
+++ b/omegaPX209/omegaPX209.cpp	Mon Oct 23 12:50:53 2017 +0000
@@ -8,20 +8,28 @@
 #include "mbed.h"
 #include "omegaPX209.hpp"
 
-omegaPX209::omegaPX209(): depthP(p19)
+omegaPX209::omegaPX209(PinName pin): 
+    depthP(pin)
 {
-    
 }
 
-void omegaPX209::initialize()
-{
+void omegaPX209::initialize() {
     P = 0;              // Pressure [psi]
     cal = 12;           // Volts per psi
     multiplier = 3.3;   // Maximum voltage in
 }
 
-float omegaPX209::calcP()
-{
+float omegaPX209::getPsi() {
     P = depthP*multiplier*cal;
     return P;
 }
+
+// math sourced from http://www.kylesconverter.com/pressure/feet-of-water-to-pounds-per-square-inch
+float omegaPX209::getDepth() {
+    P = getPsi(); // read the sensor
+    float pascals = (P * 6894.76) - (14.7 * 6894.76); // convert psi to Pascals
+    float depth_m = pascals / (density_of_water_g_cc * 1000 * 9.80665); // convert Pa to fluid depth in meters
+    float depth_ft = 3.28084 * depth_m; // convert meters to feet
+    
+    return depth_ft;
+}
\ No newline at end of file