Przeglądaj źródła

don't set time from gps, it's too fraught with peril.

* we'll have to figure out how to set system time from something
  more reasonable, like network time or something.
* I don't know how this ever worked...GGA and RMC messages explicitly
  only have utc hour:min:sec not century etc.
* took out warnings for snprintf truncation. I'm explicitely passing
  in a bound on the string as well as using snprintf, I know it has
  the potential to be truncated, that's why I'm using snprintf
Abram Connelly 6 lat temu
rodzic
commit
292097bbe4
3 zmienionych plików z 5 dodań i 6 usunięć
  1. 1 1
      busunit/DIUv2/buildit.sh
  2. 1 1
      busunit/DIUv2/diu_main.c
  3. 3 4
      busunit/gps/gps_main.c

+ 1 - 1
busunit/DIUv2/buildit.sh

@@ -3,4 +3,4 @@
 common_stuff="../commhub/commhub.c ../commhub/client_utils.c ../common/common_defs.c"
 
 rm -f diu_minder
-$target_cc $target_ccopts -o diu_minder diu_main.c touchscreen.c driver.c mongoose.c mkgmtime.c $common_stuff -lcrypto
+$target_cc $target_ccopts -Wno-format-truncation -o diu_minder diu_main.c touchscreen.c driver.c mongoose.c mkgmtime.c $common_stuff -lcrypto

+ 1 - 1
busunit/DIUv2/diu_main.c

@@ -373,7 +373,7 @@ int update_gps(char *in)
                 //     Pass the time field (f1) and the date field (f9) in to the routine that sets the system clock if needed.
                 // (this routine also stores the utc timestamp derived from the GPS date and time fields so it can be passed to
                 // other modules that may have a need for this information).
-                handle_gps_time(f1,f9);
+                //handle_gps_time(f1,f9);
             }
         }
 

+ 3 - 4
busunit/gps/gps_main.c

@@ -53,7 +53,7 @@ int handle_gps_time(float gtime, int date) {
   int day,month,year;
   int hour,min,sec,frac;
   int n = 0;
-  time_t utc,now;
+  time_t utc, now;
 
   char buffer[32] = {0};
 
@@ -64,14 +64,12 @@ int handle_gps_time(float gtime, int date) {
   day = month = year = 0; 
   hour = min = sec = frac = 0;
 
-
   //  Just to be *ahem* clear, as per NMEA standard the date is encoded DDMMYY, and the time of day
   // is encoded HHMMSS[.frac] where there is an optional fractional second field denoted by a decimal point.
   // we must be able to decode the fractional seconds field but we discard the information since it is not
   // reliable enough to be worth the bother.
   //
 
-
   // Start out with zero parsed fields
   //
   n = 0;
@@ -353,12 +351,13 @@ int update_gps(char *in) {
         // (this routine also stores the utc timestamp derived from the GPS date and time fields so it can be passed to
         // other modules that may have a need for this information).
         //
-        handle_gps_time(f1,(int)f9);
+        //handle_gps_time(f1,(int)f9);
 
       }
     }
 
     if(num > 0) {
+
       // update snapshot with latitude
       //
       my_gps_stat.lat = f3 * ((f4 == 'N')?(1):(-1));