Skip to content

Commit

Permalink
Accept do faster ETX caclculation after last ETX probe or unicast tra…
Browse files Browse the repository at this point in the history
…ffic.

Added definition for define how many accelerated ETX update will be done before start follow cached value.

Change-Id: I59ba142ff0ee3a8b46566c7d4a2b7b98abe692b0
  • Loading branch information
Juha Heiskanen committed May 3, 2019
1 parent 202e579 commit cbb4acf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/Service_Libs/etx/etx.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static bool etx_update_possible(etx_sample_storage_t *storage, etx_storage_t *en
}
}

if (entry->etx_samples == 7) {
if (entry->etx_samples > ETX_ACCELERATED_SAMPLE_COUNT) {
//Slower ETX update phase
if (storage->sample_count < etx_info.min_sample_count || storage->etx_timer) {
if (storage->sample_count < 0xff) {
Expand All @@ -140,7 +140,7 @@ static bool etx_update_possible(etx_sample_storage_t *storage, etx_storage_t *en
}
} else {
//Accelerated ETX at for new neighbor
if (storage->sample_count < 3) {
if (storage->sample_count < ETX_ACCELERATED_INTERVAL) {
return false;
}
}
Expand Down
19 changes: 19 additions & 0 deletions source/Service_Libs/etx/etx.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@
Range for value can be from 1 to 11 */
#define ETX_MOVING_AVERAGE_FRACTION 3 // n >> 3, 1/8

/* ETX cache configuration definitions */

/* Amount of accelerated ETX samples
* After this value is received the ETX calculation starts to follow the
* slower ETX cache configuration values.
*
* Maximum value is 7
*/
#define ETX_ACCELERATED_SAMPLE_COUNT 3

/* Amount of samples before updating the ETX value when in accelerated mode.
*
* if set to 1 every sample updates an ETX value. if set to 2 every second
* ETX sample updates the ETX value.
*
* This value should be smaller than ETX_ACCELERATED_SAMPLE_COUNT
*/
#define ETX_ACCELERATED_INTERVAL 2

typedef struct etx_storage_s {
uint16_t etx; /*!< 12 bits fraction */
uint16_t stored_diff_etx; /*!< 12 bits fraction */
Expand Down

0 comments on commit cbb4acf

Please sign in to comment.