jn516x examples: print out network state periodically

This commit is contained in:
Simon Duquennoy 2015-12-02 10:26:06 +01:00
parent 3ff44f77b9
commit bef32c20fb
4 changed files with 69 additions and 3 deletions

View file

@ -58,6 +58,7 @@ AUTOSTART_PROCESSES(&node_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(node_process, ev, data)
{
static struct etimer et;
PROCESS_BEGIN();
/* 3 possible roles:
@ -71,8 +72,6 @@ PROCESS_THREAD(node_process, ev, data)
#if CONFIG_VIA_BUTTON
{
#define CONFIG_WAIT_TIME 10
static struct etimer et;
SENSORS_ACTIVATE(button_sensor);
etimer_set(&et, CLOCK_SECOND * CONFIG_WAIT_TIME);
@ -103,6 +102,16 @@ PROCESS_THREAD(node_process, ev, data)
rpl_tools_init(&prefix);
} else {
rpl_tools_init(NULL);
} PROCESS_END();
}
/* Print out routing tables every minute */
etimer_set(&et, CLOCK_SECOND * 60);
while(1) {
print_network_status();
PROCESS_YIELD_UNTIL(etimer_expired(&et));
etimer_reset(&et);
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/