Merge pull request #1740 from simonduq/pr/tsch-minor

TSCH minor enhancements
This commit is contained in:
Nicolas Tsiftes 2016-09-05 16:33:48 +02:00 committed by GitHub
commit 7cfbbe97af
3 changed files with 21 additions and 8 deletions

View file

@ -349,6 +349,7 @@ tsch_rx_process_pending()
/* Copy to packetbuf for processing */
packetbuf_copyfrom(current_input->payload, current_input->len);
packetbuf_set_attr(PACKETBUF_ATTR_RSSI, current_input->rssi);
packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, current_input->channel);
}
/* Remove input from ringbuf */
@ -549,10 +550,6 @@ tsch_associate(const struct input_packet *input_eb, rtimer_clock_t timestamp)
if(n != NULL) {
tsch_queue_update_time_source((linkaddr_t *)&frame.src_addr);
#ifdef TSCH_CALLBACK_JOINING_NETWORK
TSCH_CALLBACK_JOINING_NETWORK();
#endif
/* Set PANID */
frame802154_set_pan_id(frame.src_pid);
@ -563,9 +560,13 @@ tsch_associate(const struct input_packet *input_eb, rtimer_clock_t timestamp)
tsch_is_associated = 1;
tsch_is_pan_secured = frame.fcf.security_enabled;
/* Association done, schedule keepalive messages */
/* Start sending keep-alives now that tsch_is_associated is set */
tsch_schedule_keepalive();
#ifdef TSCH_CALLBACK_JOINING_NETWORK
TSCH_CALLBACK_JOINING_NETWORK();
#endif
PRINTF("TSCH: association done, sec %u, PAN ID %x, asn-%x.%lx, jp %u, timeslot id %u, hopping id %u, slotframe len %u with %u links, from ",
tsch_is_pan_secured,
frame.src_pid,
@ -909,7 +910,10 @@ send_packet(mac_callback_t sent, void *ptr)
/* Enqueue packet */
p = tsch_queue_add_packet(addr, sent, ptr);
if(p == NULL) {
PRINTF("TSCH:! can't send packet !tsch_queue_add_packet\n");
PRINTF("TSCH:! can't send packet to %u with seqno %u, queue %u %u\n",
TSCH_LOG_ID_FROM_LINKADDR(addr), tsch_packet_seqno,
packet_count_before,
tsch_queue_packet_count(addr));
ret = MAC_TX_ERR;
} else {
p->header_len = hdr_len;
@ -982,6 +986,11 @@ turn_on(void)
static int
turn_off(int keep_radio_on)
{
if(keep_radio_on) {
NETSTACK_RADIO.on();
} else {
NETSTACK_RADIO.off();
}
return 1;
}
/*---------------------------------------------------------------------------*/