Fiddled with the timing

This commit is contained in:
adamdunkels 2010-03-31 11:54:38 +00:00
parent c21ff48788
commit 877eb2fbe9
2 changed files with 10 additions and 8 deletions

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: contikimac.c,v 1.19 2010/03/30 23:01:32 adamdunkels Exp $
* $Id: contikimac.c,v 1.20 2010/03/31 11:54:38 adamdunkels Exp $
*/
/**
@ -99,7 +99,7 @@ struct announcement_msg {
#define CYCLE_TIME (RTIMER_ARCH_SECOND / MAC_CHANNEL_CHECK_RATE)
#endif
#define MAX_PHASE_STROBES 8
#define MAX_PHASE_STROBES 12
#define CCA_COUNT_MAX 2
#define CCA_CHECK_TIME RTIMER_ARCH_SECOND / 8192
@ -108,7 +108,7 @@ struct announcement_msg {
#define STREAM_CCA_COUNT (CYCLE_TIME / (CCA_SLEEP_TIME + CCA_CHECK_TIME) - CCA_COUNT_MAX)
#define GUARD_TIME 3 * CHECK_TIME
#define GUARD_TIME 7 * CHECK_TIME
#define INTER_PACKET_INTERVAL RTIMER_ARCH_SECOND / 5000
#define AFTER_ACK_DETECTECT_WAIT_TIME RTIMER_ARCH_SECOND / 1500
@ -694,7 +694,8 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
if(len == ACK_LEN) {
leds_on(LEDS_BLUE);
got_strobe_ack = 1;
encounter_time = last_transmission_time;
// encounter_time = last_transmission_time;
encounter_time = now;
break;
} else {
PRINTF("contikimac: collisions while sending\n");

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: phase.c,v 1.5 2010/03/29 21:50:01 adamdunkels Exp $
* $Id: phase.c,v 1.6 2010/03/31 11:54:38 adamdunkels Exp $
*/
/**
@ -73,7 +73,7 @@ MEMB(phase_memb, struct phase_queueitem, PHASE_QUEUESIZE);
/*---------------------------------------------------------------------------*/
void
phase_update(const struct phase_list *list,
const rimeaddr_t * neighbor, rtimer_clock_t time,
const rimeaddr_t *neighbor, rtimer_clock_t time,
int mac_status)
{
struct phase *e;
@ -89,7 +89,7 @@ phase_update(const struct phase_list *list,
phase (rebooted). We try a number of transmissions to it
before we drop it from the phase list. */
if(mac_status == MAC_TX_NOACK) {
printf("phase noacks %d\n", e->noacks);
printf("phase noacks %d to %d.%d\n", e->noacks, neighbor->u8[0], neighbor->u8[1]);
e->noacks++;
if(e->noacks >= MAX_NOACKS) {
list_remove(*list->list, e);
@ -162,7 +162,8 @@ phase_wait(struct phase_list *list,
/* printf("neighbor phase 0x%02x (cycle 0x%02x)\n", e->time & (cycle_time - 1),
cycle_time);*/
now = RTIMER_NOW();
wait = (rtimer_clock_t)((e->time - now - e->noacks * cycle_time) & (cycle_time - 1));
wait = (rtimer_clock_t)((e->time - now - e->noacks * wait_before) &
(cycle_time - 1));
if(wait < wait_before) {
wait += cycle_time;
}