some cleaning
[protos/imu.git] / gps_venus.c
index 20d8639..01551a6 100644 (file)
@@ -541,15 +541,12 @@ void gps_get_pos(struct gps_pos *pos)
 
 int gps_loop(void)
 {
 
 int gps_loop(void)
 {
-       struct fat_file_struct *fd = NULL;
        uint32_t ms;
        uint8_t flags, prio;
        int16_t len;
        char buf[128];
        struct gps_pos pos;
 
        uint32_t ms;
        uint8_t flags, prio;
        int16_t len;
        char buf[128];
        struct gps_pos pos;
 
-       fd = get_log_file();
-
        while (1) {
 
                IRQ_LOCK(flags);
        while (1) {
 
                IRQ_LOCK(flags);
@@ -573,9 +570,9 @@ int gps_loop(void)
                        (double)gps_pos.sea_altitude/100.);
 
 
                        (double)gps_pos.sea_altitude/100.);
 
 
-               if (fd != NULL) {
+               if (sd_log_enabled()) {
 
 
-                       if (fat_write_file(fd, (unsigned char *)buf, len) != len) {
+                       if (sd_log_write(buf, len) != len) {
                                printf_P(PSTR("error writing to file\n"));
                                return -1;
                        }
                                printf_P(PSTR("error writing to file\n"));
                                return -1;
                        }