modifiche posizione iniziale e sistema d'allarme.

Dependencies:   MTK3339 TextLCD mbed tsi_sensor

Fork of app_gps by Dennis Morello

Revision:
3:5353387b52f7
Parent:
2:3a9cacc54417
Child:
5:244867f8fc75
--- a/main.cpp	Mon Jul 13 11:08:09 2015 +0000
+++ b/main.cpp	Mon Jul 13 12:44:39 2015 +0000
@@ -90,26 +90,28 @@
         coords[LON][i%N] = gps.getLongitudeAsDegrees();
         wait(1);
         
-        if (i>=N) {
+        if (i>=2*N) {
             meanLat  = mean(coords[LAT], N);
             meanLon  = mean(coords[LON], N);
             stdevLat = stdev(coords[LAT], N);
             stdevLon = stdev(coords[LON], N);
             
             lcd.cls();
-            lcd.printf("%f\n%f", stdevLat, stdevLon);
+            lcd.printf("%f\n%f %d", stdevLat, stdevLon, i);
             
-            for (int j=0; j<N; j++) {
+            if (stdevLat <= 0.00001)
+                set = true;
+            /*for (int j=0; j<N; j++) {
                 if (coords[LAT][j] > meanLat-stdevLat && coords[LAT][j] < meanLat+stdevLat &&
                     coords[LON][j] > meanLon-stdevLon && coords[LON][j] < meanLon+stdevLon)
                     c++;
-            }
+            }*/
             
-            if (c>=N*.5) {
+            /*if (c>=N*.5) {
                 initPos[LAT] = coords[LAT][i%N];
                 initPos[LON] = coords[LON][i%N];
                 set = true;
-            }
+            }*/
         }
         
         i++;
@@ -125,6 +127,8 @@
 
 int main(void)
 {
+    wait(2);
+    printf("Ciao");
 
     double d;