/*---------------------------------------------------------------------------*/ PROCESS_THREAD(depth_blink_process, ev, data) { static struct etimer et; static int count; PROCESS_BEGIN(); while(1) { etimer_set(&et, CLOCK_SECOND * 10); PROCESS_WAIT_UNTIL(etimer_expired(&et)); count = collect_depth(&tc); if(count == COLLECT_MAX_DEPTH) { leds_on(LEDS_BLUE); } else { leds_off(LEDS_BLUE); count /= COLLECT_LINK_ESTIMATE_UNIT; while(count > 0) { leds_on(LEDS_RED); etimer_set(&et, CLOCK_SECOND / 32); PROCESS_WAIT_UNTIL(etimer_expired(&et)); leds_off(LEDS_RED); etimer_set(&et, CLOCK_SECOND / 8); PROCESS_WAIT_UNTIL(etimer_expired(&et)); --count; } } } PROCESS_END(); }
PROCESS_THREAD(shell_treedepth_process, ev, data) { char buf[20]; PROCESS_BEGIN(); snprintf(buf, sizeof(buf), "%d", collect_depth(&collect)); shell_output_str(&treedepth_command, buf, ""); PROCESS_END(); }