]> git.droids-corp.org - protos/xbee-avr.git/commitdiff
xbee_proto: replace printf printf_P
authorFabrice Desclaux <serpilliere@droids-corp.org>
Tue, 21 Feb 2012 18:33:28 +0000 (19:33 +0100)
committerFabrice Desclaux <serpilliere@droids-corp.org>
Tue, 21 Feb 2012 18:33:28 +0000 (19:33 +0100)
xbee_proto.c

index bd284dd46acac3a452dbb5d6a7f21605aff1f7ac..05f0b564d64ea7d7c25a5955efb7142e7a0f6de7 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <aversive.h>
+#include <aversive/pgmspace.h>
 #include <aversive/queue.h>
 #include <aversive/endian.h>
 
@@ -138,7 +139,7 @@ static int xbee_proto_parse_frame(struct xbee_dev *dev)
        /* check frame len */
        if (len < (hdrlen + 1)) {
                dev->stats.rx_frame_too_small++;
-               fprintf(stderr, "Frame too small\n");
+               fprintf_P(stderr, PSTR("Frame too small\r\n"));
                return -1;
        }
 
@@ -147,7 +148,7 @@ static int xbee_proto_parse_frame(struct xbee_dev *dev)
                cksum += ((uint8_t *)buf)[i];
        cksum = 0xff - cksum;
        if (cksum != ((uint8_t *)buf)[len-1]) {
-               fprintf(stderr, "Invalid cksum\n");
+               fprintf_P(stderr, PSTR("Invalid cksum\r\n"));
                dev->stats.rx_invalid_cksum++;
                return -1;
        }
@@ -273,7 +274,8 @@ int xbee_proto_xmit(struct xbee_dev *dev, uint8_t channel_id, uint8_t type,
                case XBEE_TYPE_RMT_ATRESP:
                default:
                        dev->stats.tx_invalid_type ++;
-                       fprintf(stderr, "unhandled xmit type=%x\n", hdr.type);
+                       fprintf_P(stderr, PSTR("unhandled xmit type=%x\r\n"),
+                                 hdr.type);
                        return -1;
        }