display xbee result in decimal
[protos/xbee-avr.git] / main.c
diff --git a/main.c b/main.c
index c6f13e3..7dc45bb 100644 (file)
--- a/main.c
+++ b/main.c
@@ -203,15 +203,16 @@ static int dump_atcmd(struct xbee_ctx *ctx, struct xbee_atresp_hdr *frame,
        result = (void *)frame->data;
        len -= offsetof(struct xbee_atresp_hdr, data);
        if (cmd.flags & XBEE_ATCMD_F_PARAM_U8 && len == sizeof(uint8_t))
-               printf_P(PSTR("<%s> is 0x%x\r\n"), atcmd_str, result->u8);
+               printf_P(PSTR("<%s> is 0x%x (%d)\r\n"), atcmd_str, result->u8,
+                        result->u8);
        else if (cmd.flags & XBEE_ATCMD_F_PARAM_U16 && len == sizeof(uint16_t))
-               printf_P(PSTR("<%s> is 0x%x\r\n"),
+               printf_P(PSTR("<%s> is 0x%x (%d)\r\n"),
                         atcmd_str,
-                        ntohs(result->u16));
+                        ntohs(result->u16), ntohs(result->u16));
        else if (cmd.flags & XBEE_ATCMD_F_PARAM_U32 && len == sizeof(uint32_t))
-               printf_P(PSTR("<%s> is 0x%"PRIx32"\r\n"),
+               printf_P(PSTR("<%s> is 0x%"PRIx32" (%"PRIu32")\r\n"),
                         atcmd_str,
-                        ntohl(result->u32));
+                        ntohl(result->u32), ntohs(result->u32));
        else if (cmd.flags & XBEE_ATCMD_F_PARAM_S16 && len == sizeof(int16_t))
                printf_P(PSTR("<%s> is %d\r\n"), atcmd_str, ntohs(result->s16));
        else if (len == 0)