Guides the user to their classes

Dependencies:   4DGL-uLCD-SE Course SDFileSystem mbed PinDetect LSM9DS1_Library_cal MBed_Adafruit-GPS-Library

Revision:
9:5b871fb9f554
Parent:
8:3266cc9eda81
Child:
10:5579618161ef
--- a/main.cpp	Thu Dec 08 21:21:38 2016 +0000
+++ b/main.cpp	Thu Dec 08 21:34:01 2016 +0000
@@ -24,7 +24,7 @@
 int getNextClass(vector<Course>& cVec);
 void displayCourseVec();
 float calculateHeading(float mx, float my), computeAngleToDestination(float diffLat, float diffLong);
-float longToDecimal(float longitudeInDDMM), latToDecimal(float latitudeInDDMM);
+float longToDecimal(float longitudeInDDMM, char eastOrWest), latToDecimal(float latitudeInDDMM, char northOrSouth);
 int xEnd, yEnd = 0.0;
 int currHour, currMinute, currSecond = 0;
 int hoursToNextClass, minutesToNextClass, secondsToNextClass = 0;
@@ -128,10 +128,10 @@
         if (refresh_Timer.read_ms() >= refresh_Time) {
             refresh_Timer.reset();
             if (myGPS.fix) {
-                myLat = latToDecimal(myGPS.latitude);
-                myLong = longToDecimal(myGPS.longitude);
+                myLat = latToDecimal(myGPS.latitude, myGPS.lat);
+                myLong = longToDecimal(myGPS.longitude, myGPS.lon);
             }
- 
+
             currHour = myGPS.hour - 5; //for eastern time zone
             if (currHour < 0)
                 currHour += 24;
@@ -391,7 +391,7 @@
 }
 
 // convert from DDMM.mmmm to decimal
-float latToDecimal(float latitudeInDDMM)
+float latToDecimal(float latitudeInDDMM, char northOrSouth)
 {
     float latInDec = 0.0;
     float temp = 0.0;
@@ -399,10 +399,12 @@
     temp = latInDec - floor(latInDec);
     temp = temp / .6;
     latInDec = floor(latInDec) + temp;
+    if (eastOrWest == 'S')
+        return -1 * latInDec;
     return latInDec;
 }
 
-float longToDecimal(float longitudeInDDMM)
+float longToDecimal(float longitudeInDDMM, char eastOrWest)
 {
     float longInDec = 0.0;
     float temp = 0.0;
@@ -410,5 +412,7 @@
     temp = longInDec - floor(longInDec);
     temp = temp / .6;
     longInDec = floor(longInDec) + temp;
+    if (eastOrWest == 'E')
+        return longInDec;
     return -1 * longInDec;
 }
\ No newline at end of file