Skip to content

Commit 9ed97c9

Browse files
author
Juha Heiskanen
committed
ETX update:
ETX first EPOC is not calculated RSS/LQI for cached etx anymore. Also If first epoch not RX ACK will be ETX configured MAX. Change-Id: I00c4fb90243828b9ba746fc01b174af4cc768c67
1 parent b489415 commit 9ed97c9

File tree

1 file changed

+10
-5
lines changed
  • source/Service_Libs/etx

1 file changed

+10
-5
lines changed

source/Service_Libs/etx/etx.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,24 @@ static void etx_calculation(etx_storage_t *entry, uint16_t attempts, uint8_t ack
9292
entry->stored_diff_etx = entry->etx;
9393
}
9494

95-
9695
uint32_t etx = attempts << (12 - ETX_MOVING_AVERAGE_FRACTION);
9796

98-
if (acks_rx > 1) {
97+
if (acks_rx) {
9998
etx /= acks_rx;
99+
} else {
100+
etx = 0xffff;
100101
}
101-
102102
if ((etx_info.max_etx_update) && etx > etx_info.max_etx_update) {
103103
etx = etx_info.max_etx_update;
104104
}
105105

106-
//Add old etx 7/8 to new one
107-
etx += entry->etx - (entry->etx >> ETX_MOVING_AVERAGE_FRACTION);
106+
if (etx_info.cache_sample_requested && entry->etx_samples == 1) {
107+
// skip the initial value as RSSI generated ETX is not valid
108+
etx = etx << 3;
109+
} else {
110+
//Add old etx 7/8 to new one
111+
etx += entry->etx - (entry->etx >> ETX_MOVING_AVERAGE_FRACTION);
112+
}
108113

109114
if (etx > 0xffff) {
110115
etx = 0xffff;

0 commit comments

Comments
 (0)