Skip to content

Commit d861208

Browse files
author
Juha Heiskanen
committed
Added validation for ETX Acceleration definitions.
Change-Id: I596ffefe56d581adc7980e7cc0a4e756f8926f69
1 parent cbb4acf commit d861208

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

source/Service_Libs/etx/etx.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ static void etx_value_change_callback_needed_check(uint16_t etx, uint16_t *store
4343
static void etx_accum_failures_callback_needed_check(etx_storage_t *entry, uint8_t attribute_index);
4444
static void etx_cache_entry_init(uint8_t attribute_index);
4545

46+
#if ETX_ACCELERATED_SAMPLE_COUNT == 0 || ETX_ACCELERATED_SAMPLE_COUNT > 6
47+
#error "ETX_ACCELERATED_SAMPLE_COUNT accepted values 1-6"
48+
#endif
49+
50+
#if ETX_ACCELERATED_INTERVAL == 0
51+
#error "ETX_ACCELERATED_INTERVAL can't be zero"
52+
#endif
53+
54+
#if ETX_ACCELERATED_INTERVAL >= ETX_ACCELERATED_SAMPLE_COUNT
55+
#error "ETX_ACCELERATED_INTERVAL must be < ETX_ACCELERATED_SAMPLE_COUNT"
56+
#endif
57+
4658

4759
typedef struct {
4860
etx_value_change_handler_t *callback_ptr;

source/Service_Libs/etx/etx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* After this value is received the ETX calculation starts to follow the
3838
* slower ETX cache configuration values.
3939
*
40-
* Maximum value is 7
40+
* Maximum value is 6
4141
*/
4242
#define ETX_ACCELERATED_SAMPLE_COUNT 3
4343

0 commit comments

Comments
 (0)