Remove inclusion of preprocessor directive in macro expansion. Some gcc's do not like that.

This commit is contained in:
David Kopf 2011-08-17 13:13:55 -04:00
parent b7cd4fbd90
commit d4eeeeb8c9
1 changed files with 7 additions and 12 deletions

View File

@ -44,11 +44,16 @@
#include "sys/energest.h"
#include <stdio.h>
#ifdef __AVR__
/* AVR clock_time() is only 16 bit, time would wrap in ~500 seconds */
/* Might as well use program flash while we are dirtying the core */
#include <avr/pgmspace.h>
#define PRINTA(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
#define DISPLAYTIME clock_seconds()
#else
#define PRINTA(...) printf(__VA_ARGS__)
#define DISPLAYTIME (unsigned long)clock_time() / CLOCK_SECOND
#endif
/*---------------------------------------------------------------------------*/
@ -57,12 +62,7 @@ print_stats(void)
{
PRINTA("S %d.%d clock %lu tx %lu rx %lu rtx %lu rrx %lu rexmit %lu acktx %lu noacktx %lu ackrx %lu timedout %lu badackrx %lu toolong %lu tooshort %lu badsynch %lu badcrc %lu contentiondrop %lu sendingdrop %lu lltx %lu llrx %lu\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
#ifdef __AVR__
clock_seconds(),
#else
(unsigned long)clock_time() / CLOCK_SECOND,
#endif
DISPLAYTIME,
rimestats.tx, rimestats.rx,
rimestats.reliabletx, rimestats.reliablerx,
rimestats.rexmit, rimestats.acktx, rimestats.noacktx,
@ -74,12 +74,7 @@ print_stats(void)
#if ENERGEST_CONF_ON
PRINTA("E %d.%d clock %lu cpu %lu lpm %lu irq %lu gled %lu yled %lu rled %lu tx %lu listen %lu sensors %lu serial %lu\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
#ifdef __AVR__
clock_seconds(),
#else
(unsigned long)clock_time() / CLOCK_SECOND,
#endif
DISPLAYTIME,
energest_total_time[ENERGEST_TYPE_CPU].current,
energest_total_time[ENERGEST_TYPE_LPM].current,
energest_total_time[ENERGEST_TYPE_IRQ].current,