1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

changed some of the ETX constants to be more easily understandable

This commit is contained in:
Stephan Arndt 2013-03-22 18:37:00 +01:00
parent dccc377f83
commit 85211f8408
2 changed files with 15 additions and 8 deletions

View File

@ -165,12 +165,12 @@ void etx_beacon(void) {
send_ieee802154_frame(&empty_addr, &etx_send_buf[0],
get_etx_send_buf()->length + ETX_PKT_HDR_LEN, 1);
puts("sent beacon!");
//vtimer_usleep(ETX_INTERVAL - ETX_MAX_JITTER + jittercorrection*MS + jitter*MS);
//vtimer_usleep(((ETX_INTERVAL - ETX_MAX_JITTER)*MS) + jittercorrection*MS + jitter*MS);
/// TODO once vtimer works as intended, replace the hwtimer here with
/// the vtimer. Right now vtimer bugs, so we have hwtimer here.
hwtimer_wait(HWTIMER_TICKS(ETX_INTERVAL - ETX_MAX_JITTER + jittercorrection*MS + jitter*MS));
hwtimer_wait(HWTIMER_TICKS(((ETX_INTERVAL - ETX_MAX_JITTER)*MS) + jittercorrection*MS + jitter*MS));
jittercorrection = (ETX_MAX_JITTER/MS) - jitter;
jittercorrection = (ETX_MAX_JITTER) - jitter;
//the jitter is a value between 0 and ETX_MAX_JITTER
jitter = (uint8_t) (rand() % ETX_JITTER_MOD);

View File

@ -30,15 +30,22 @@
//ETX Interval parameters
#define MS 1000
#define ETX_INTERVAL (1000 * MS) //Given in us, the default is 1 second
/*
* ETX_INTERVAL
*
* Given in ms, the default is 1 second.
* Should be divisible through 2 (For ETX_DEF_JIT_CORRECT)
* and 5 (For ETX_MAX_JITTER) unless those values are adjusted too.
*/
#define ETX_INTERVAL (1000)
#define ETX_ROUNDS (10) //10 is the default value
#define ETX_PKT_HDR_LEN (2) //Option type + Length (1 Byte each)
#define ETX_TUPLE_SIZE (2) //1 Byte for Addr, 1 Byte for packets rec.
#define ETX_PKT_REC_OFFSET (1) //Offset in a tuple of (addr,pkt_rec)
#define ETX_PKT_REC_OFFSET (ETX_TUPLE_SIZE - 1) //Offset in a tuple of (addr,pkt_rec), will always be the last byte
#define ETX_IPV6_LAST_BYTE (15) //The last byte for an ipv6 address
#define ETX_MAX_JITTER (ETX_INTERVAL/5) //The default value is 20% of ETX_INTERVAL
#define ETX_JITTER_MOD (ETX_MAX_JITTER/MS + 1) //The modulo value for jitter computation
#define ETX_DEF_JIT_CORRECT (ETX_MAX_JITTER/MS / 2) //Default Jitter correction value (normally ETX_MAX_JITTER / 2)
#define ETX_MAX_JITTER (ETX_INTERVAL / 5) //The default value is 20% of ETX_INTERVAL
#define ETX_JITTER_MOD (ETX_MAX_JITTER + 1) //The modulo value for jitter computation
#define ETX_DEF_JIT_CORRECT (ETX_MAX_JITTER / 2) //Default Jitter correction value (normally ETX_MAX_JITTER / 2)
//prototypes
void etx_init_beaconing(ipv6_addr_t * address);