]> git.droids-corp.org - fpv.git/commitdiff
change gps_loop -> gps_log
authorOlivier Matz <zer0@droids-corp.org>
Tue, 9 Sep 2014 17:03:35 +0000 (19:03 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Tue, 9 Sep 2014 17:49:31 +0000 (19:49 +0200)
imuboard/gps_venus.c
imuboard/gps_venus.h
imuboard/main.c

index 747085888db63b3af29d6bd252cfb3d327d1ad04..bd9a7745abc2f83e6e4cf994e3ec0a2897310561 100644 (file)
@@ -560,7 +560,7 @@ void gps_get_pos(struct gps_pos *pos)
        memcpy(pos, &gps_pos, sizeof(*pos));
 }
 
-int gps_loop(void)
+int gps_log(void)
 {
        uint32_t ms;
        uint8_t flags, prio;
@@ -568,39 +568,35 @@ int gps_loop(void)
        char buf[128];
        struct gps_pos pos;
 
-       while (1) {
-
-               IRQ_LOCK(flags);
-               ms = global_ms;
-               IRQ_UNLOCK(flags);
-
-               /* get position (prevent modification of gps pos during copy) */
-               prio = callout_mgr_set_prio(&imuboard.intr_cm, GPS_PRIO);
-               gps_get_pos(&pos);
-               callout_mgr_restore_prio(&imuboard.intr_cm, prio);
-
-               /* XXX copy */
-               len = snprintf(buf, sizeof(buf),
-                       "%"PRIu32" "
-                       "svnum %.2X lat %3.5f long %3.5f "
-                       "alt %3.5f sea_alt %3.5f\n",
-                       ms, gps_pos.sv_num,
-                       (double)gps_pos.latitude/10000000.,
-                       (double)gps_pos.longitude/10000000.,
-                       (double)gps_pos.altitude/100.,
-                       (double)gps_pos.sea_altitude/100.);
-
-
-               if (sd_log_enabled()) {
-
-                       if (sd_log_write(buf, len) != len) {
-                               printf_P(PSTR("error writing to file\n"));
-                               return -1;
-                       }
+       IRQ_LOCK(flags);
+       ms = global_ms;
+       IRQ_UNLOCK(flags);
+
+       /* get position (prevent modification of gps pos during copy) */
+       prio = callout_mgr_set_prio(&imuboard.intr_cm, GPS_PRIO);
+       gps_get_pos(&pos);
+       callout_mgr_restore_prio(&imuboard.intr_cm, prio);
+
+       /* XXX copy */
+       len = snprintf(buf, sizeof(buf),
+               "%"PRIu32" "
+               "svnum %.2X lat %3.5f long %3.5f "
+               "alt %3.5f sea_alt %3.5f\n",
+               ms, gps_pos.sv_num,
+               (double)gps_pos.latitude / 10000000.,
+               (double)gps_pos.longitude / 10000000.,
+               (double)gps_pos.altitude / 100.,
+               (double)gps_pos.sea_altitude / 100.);
+
+
+       if (sd_log_enabled()) {
+               if (sd_log_write(buf, len) != len) {
+                       printf_P(PSTR("error writing to file\n"));
+                       return -1;
                }
-               else
-                       printf_P(PSTR("%s"), buf);
-
+       }
+       else {
+               printf_P(PSTR("%s"), buf);
        }
 
        return 0;
index ca2bd8fff9614d6868e741a3c34e8b3d0bb0d17f..7970088b52f8d5c7032a775594de73455b7d30bf 100644 (file)
@@ -38,7 +38,7 @@ struct gps_pos {
 } __attribute__ ((packed));
 
 int gps_venus_init(void);
-int gps_loop(void);
+int gps_log(void);
 
 /* does not lock intr, must be done by user */
 void gps_get_pos(struct gps_pos *pos);
index 386528bed3eb598ee27112b93eb71909620bce0f..bee118f543787c4c0c0eaea2b3063b6b09d5d473 100644 (file)
@@ -184,11 +184,13 @@ int main(void)
 
        //sd_main();
        imu_init();
-       //imu_loop();
        gps_venus_init();
-       gps_loop();
+
+       imuboard.flags |= IMUBOARD_F_BOOT_OK;
 
        while (1) {
+               //imu_log();
+               //gps_log();
                cmdline_poll();
        }