fix bug in print_packet

Thanks dean and jim.
This commit is contained in:
maralvira 2010-11-07 14:07:33 +00:00
parent f1fede7090
commit e886e83908

View File

@ -30,7 +30,7 @@
* This file is part of libmc1322x: see http://mc1322x.devl.org * This file is part of libmc1322x: see http://mc1322x.devl.org
* for details. * for details.
* *
* $Id: tests.c,v 1.2 2010/11/07 14:06:58 maralvira Exp $ * $Id: tests.c,v 1.3 2010/11/07 14:07:33 maralvira Exp $
*/ */
#include <mc1322x.h> #include <mc1322x.h>
@ -49,7 +49,7 @@ void print_packet(volatile packet_t *p) {
#define PER_ROW 16 #define PER_ROW 16
if(p) { if(p) {
printf("len 0x%02x lqi 0x%02x", p->length, p->lqi); printf("len 0x%02x lqi 0x%02x", p->length, p->lqi);
for(j=0, k=0; j <= ((p->length)%PER_ROW); j++) { for(j=0, k=0; j <= ( (p->length) / PER_ROW ); j++) {
printf("\n\r"); printf("\n\r");
for(i=0; i < PER_ROW; i++, k++) { for(i=0; i < PER_ROW; i++, k++) {
if(k >= p->length ) { if(k >= p->length ) {