use printf_P instead of printf if possible
[fpv.git] / imuboard / gps_venus.c
index 22e2076..1570912 100644 (file)
@@ -18,8 +18,8 @@
 #include "sd_raw_config.h"
 #include "sd_log.h"
 
-#define debug_printf(args...) do { } while (0)
-/* #define debug_printf(args...) printf(args) */
+#define debug_printf(fmt, a...) do { } while (0)
+/* #define debug_printf(fmt, ...) printf_P(PSTR(fmt), ##__VA_ARGS__) */
 
 #define GPS_UART 0
 
@@ -399,11 +399,11 @@ int wait_ack(int msg_type)
                        continue;
 
                if (rxframe.data[0] == 0x83)
-                       printf("ACK\n");
+                       printf_P(PSTR("ACK\n"));
                else if (rxframe.data[0] == 0x84)
-                       printf("NACK\n");
+                       printf_P(PSTR("NACK\n"));
                else
-                       printf("ZARB\n");
+                       printf_P(PSTR("ZARB\n"));
                break;
        }
 
@@ -451,32 +451,34 @@ static int decode_gps_pos(uint8_t *buf, uint16_t len)
 /* display current GPS position stored in the global variable */
 static void display_gps(void)
 {
-       printf("id %.2X mode %.2X svnum %.2X gpsw %.4X tow %.10"PRIu32"\t",
+       printf_P(PSTR("id %.2X mode %.2X svnum %.2X gpsw %.4X "
+                       "tow %.10"PRIu32"\t"),
                gps_pos.msg_id,
                gps_pos.mode,
                gps_pos.sv_num,
                gps_pos.gps_week,
                gps_pos.tow);
 
-       printf("lat %.8"PRIx32" long %.8"PRIx32" alt %.8"PRIx32"\n",
+       printf_P(PSTR("lat %.8"PRIx32" long %.8"PRIx32" alt %.8"PRIx32"\n"),
                gps_pos.latitude,
                gps_pos.longitude,
                gps_pos.altitude);
 
-       printf("gdop %3.3f pdop %3.3f hdop %3.3f vdop %3.3f tdop %3.3f\n",
+       printf_P(PSTR("gdop %3.3f pdop %3.3f hdop %3.3f vdop %3.3f "
+                       "tdop %3.3f\n"),
                (double)gps_pos.gdop/100.,
                (double)gps_pos.pdop/100.,
                (double)gps_pos.hdop/100.,
                (double)gps_pos.vdop/100.,
                (double)gps_pos.tdop/100.);
 
-       printf("lat %3.5f long %3.5f alt %3.5f sea_alt %3.5f\n",
+       printf_P(PSTR("lat %3.5f long %3.5f alt %3.5f sea_alt %3.5f\n"),
                (double)gps_pos.latitude/10000000.,
                (double)gps_pos.longitude/10000000.,
                (double)gps_pos.altitude/100.,
                (double)gps_pos.sea_altitude/100.);
 
-       printf("vx %3.3f vy %3.3f vz %3.3f\n",
+       printf_P(PSTR("vx %3.3f vy %3.3f vz %3.3f\n"),
                (double)gps_pos.ecef_vx/100.,
                (double)gps_pos.ecef_vy/100.,
                (double)gps_pos.ecef_vz/100.);
@@ -511,7 +513,7 @@ static void gps_venus_cb(struct callout_mgr *cm, struct callout *tim, void *arg)
 static void venus634_configure(void)
 {
        /* ask the GPS to reset */
-       printf("init...");
+       printf_P(PSTR("init..."));
        venus634_restart();
        wait_ack(M_RESTART);
 
@@ -519,19 +521,19 @@ static void venus634_configure(void)
         * properly */
        wait_ms(500);
 
-       printf("binmode...");
+       printf_P(PSTR("binmode..."));
        venus634_msg_type();
        wait_ack(M_OUTPUT);
 
-       printf("waas...");
+       printf_P(PSTR("waas..."));
        venus634_waas();
        wait_ack(M_WAAS);
 
-       printf("rate...");
+       printf_P(PSTR("rate..."));
        venus634_rate();
        wait_ack(M_RATE);
 
-       printf("GPS configuration done !\n");
+       printf_P(PSTR("GPS configuration done !\n"));
 }
 
 /*
@@ -592,7 +594,7 @@ int gps_loop(void)
                        }
                }
                else
-                       printf("%s", buf);
+                       printf_P(PSTR("%s"), buf);
 
        }