Fix all stdio reading functions to be __critical
[fw/altos] / src / ao_gps_print.c
index 8cc07c85790e5264d49bb695090cb6c66bb5af71..11213174be357b97ac43aa18dbc74489a4fe362f 100644 (file)
@@ -53,6 +53,13 @@ ao_gps_print(__xdata struct ao_gps_data *gps_data) __reentrant
 
                ao_gps_split(gps_data->latitude, &lat);
                ao_gps_split(gps_data->longitude, &lon);
+               if (gps_data->flags & AO_GPS_DATE_VALID)
+                       printf(" 20%02d-%02d-%02d",
+                              gps_data->year,
+                              gps_data->month,
+                              gps_data->day);
+               else
+                       printf (" 0000-00-00");
                printf(" %2d:%02d:%02d",
                       gps_data->hour,
                       gps_data->minute,
@@ -82,14 +89,43 @@ ao_gps_print(__xdata struct ao_gps_data *gps_data) __reentrant
                       gps_data->course * 2,
                       climb / 100,
                       climb % 100);
-               printf(" %d.%d(hdop) %5u(herr) %5u(verr)\n",
+               printf(" %d.%d(hdop) %5u(herr) %5u(verr)",
                       gps_data->hdop / 5,
                       (gps_data->hdop * 2) % 10,
                       gps_data->h_error,
                       gps_data->v_error);
        } else if (gps_data->flags & AO_GPS_RUNNING) {
-               printf(" unlocked\n");
+               printf(" unlocked");
        } else {
-               printf (" not-connected\n");
+               printf (" not-connected");
+       }
+}
+
+void
+ao_gps_tracking_print(__xdata struct ao_gps_tracking_data *gps_tracking_data) __reentrant
+{
+       uint8_t c, n, v;
+       __xdata struct ao_gps_sat_data  *sat;
+       printf("SAT ");
+       n = gps_tracking_data->channels;
+       if (n == 0) {
+               printf("not-connected");
+               return;
+       }
+       sat = gps_tracking_data->sats;
+       v = 0;
+       for (c = 0; c < n; c++) {
+               if (sat->svid)
+                       v++;
+               sat++;
+       }
+       printf("%d ", v);
+       sat = gps_tracking_data->sats;
+       for (c = 0; c < n; c++) {
+               if (sat->svid)
+                       printf (" %3d %3d",
+                               sat->svid,
+                               sat->c_n_1);
+               sat++;
        }
 }