- printf("%s at [%p], len=%d\n", title, data, len);
+ printf_P(PSTR("%s at [%p], len=%d\n"), title, data, len);
- out = snprintf(line, LINE_LEN, "%08X", ofs);
+ out = snprintf_P(line, LINE_LEN, PSTR("%08X"), ofs);
for (;i<=16;i++)
out += snprintf(line+out, LINE_LEN - out, " ");
for (i=0; ofs < len && i<16; i++, ofs++) {
unsigned char c = data[ofs];
if (!isascii(c) || !isprint(c))
c = '.';
for (;i<=16;i++)
out += snprintf(line+out, LINE_LEN - out, " ");
for (i=0; ofs < len && i<16; i++, ofs++) {
unsigned char c = data[ofs];
if (!isascii(c) || !isprint(c))
c = '.';
/* see if it matches query */
if (memcmp(atcmd_str, ctx->atcmd_query, 2)) {
/* see if it matches query */
if (memcmp(atcmd_str, ctx->atcmd_query, 2)) {
- printf("invalid response <%c%c><%s><%s>\n",
- frame->cmd & 0xFF,
- (frame->cmd >> 8) & 0xFF,
- atcmd_str, ctx->atcmd_query);
+ printf_P(PSTR("invalid response <%c%c><%s><%s>\r\n"),
+ frame->cmd & 0xFF,
+ (frame->cmd >> 8) & 0xFF,
+ atcmd_str, ctx->atcmd_query);
return -1;
}
memcpy_P(&cmd, cmd_pgm, sizeof(cmd));
/* bad status */
if (frame->status == 1) {
return -1;
}
memcpy_P(&cmd, cmd_pgm, sizeof(cmd));
/* bad status */
if (frame->status == 1) {
result = (void *)frame->data;
len -= offsetof(struct xbee_atresp_hdr, data);
if (cmd.flags & XBEE_ATCMD_F_PARAM_U8 && len == sizeof(uint8_t))
result = (void *)frame->data;
len -= offsetof(struct xbee_atresp_hdr, data);
if (cmd.flags & XBEE_ATCMD_F_PARAM_U8 && len == sizeof(uint8_t))
int xbee_recv_data(struct xbee_recv_hdr *recvframe, unsigned len)
{
int datalen = len - sizeof(*recvframe);
int xbee_recv_data(struct xbee_recv_hdr *recvframe, unsigned len)
{
int datalen = len - sizeof(*recvframe);
- printf("type=0x%x, channel=%d, ctx=%p\n", type, channel, ctx);
+ printf_P(PSTR("type=0x%x, channel=%d, ctx=%p\r\n"),
+ type, channel, ctx);
/* if ctx is !NULL, it is an answer to a query */
if (ctx != NULL) {
/* XXX only delete timeout if answer matched */
xbee_unload_timeout(ctx);
if (xbee_debug && ctx->atcmd_query)
/* if ctx is !NULL, it is an answer to a query */
if (ctx != NULL) {
/* XXX only delete timeout if answer matched */
xbee_unload_timeout(ctx);
if (xbee_debug && ctx->atcmd_query)
- printf("Received answer to query <%c%c>\n",
- ctx->atcmd_query[0], ctx->atcmd_query[1]);
+ printf_P(PSTR("Received answer to query <%c%c>\r\n"),
+ ctx->atcmd_query[0], ctx->atcmd_query[1]);
} addr;
memcpy(&addr, frame, sizeof(addr));
addr.u64 = ntohll(addr.u64);
} addr;
memcpy(&addr, frame, sizeof(addr));
addr.u64 = ntohll(addr.u64);
- printf("from remote address %"PRIx32"%"PRIx32"\n",
- addr.u32.high, addr.u32.low);
+ printf_P(PSTR("from remote address %"PRIx32"%"PRIx32"\r\n"),
+ addr.u32.high, addr.u32.low);
/* this answer contains an atcmd answer at offset 10 */
if (dump_atcmd(ctx, frame + 10, len - 10) < 0)
/* this answer contains an atcmd answer at offset 10 */
if (dump_atcmd(ctx, frame + 10, len - 10) < 0)
ret = xbee_proto_xmit(xbee_dev, channel, type, buf,
len);
if (ret < 0) {
ret = xbee_proto_xmit(xbee_dev, channel, type, buf,
len);
if (ret < 0) {