Eliminate incorrect cast in printf string argument
[fw/altos] / ao_gps.c
index 83f44d55f42f80c0c738b5f754d04b6c3f40d610..353272f1badb4558a7825a13387d49b2b87b4564 100644 (file)
--- a/ao_gps.c
+++ b/ao_gps.c
@@ -17,8 +17,6 @@
 
 #include "ao.h"
 
-__xdata struct ao_task ao_gps_task;
-
 #define AO_GPS_LEADER          6
 
 static const uint8_t ao_gps_header[] = "GPGGA,";
@@ -248,15 +246,31 @@ ao_gps(void) __reentrant
                        ao_gps_error = 1;
                if (!ao_gps_error) {
                        ao_mutex_get(&ao_gps_mutex);
-                       memcpy(&ao_gps_data, &ao_gps_next, sizeof (ao_gps_data));
+                       memcpy(&ao_gps_data, &ao_gps_next, sizeof (struct ao_gps_data));
                        ao_mutex_put(&ao_gps_mutex);
                        ao_wakeup(&ao_gps_data);
                }
        }
 }
 
+__xdata struct ao_task ao_gps_task;
+
+static void
+gps_dump(void) __reentrant
+{
+       ao_mutex_get(&ao_gps_mutex);
+       ao_gps_print(&ao_gps_data);
+       ao_mutex_put(&ao_gps_mutex);
+}
+
+__code struct ao_cmds ao_gps_cmds[] = {
+       { 'g', gps_dump,        "g                                  Display current GPS values" },
+       { 0, gps_dump, NULL },
+};
+
 void
 ao_gps_init(void)
 {
        ao_add_task(&ao_gps_task, ao_gps, "gps");
+       ao_cmd_register(&ao_gps_cmds[0]);
 }