@@ -64,11 +64,11 @@ typedef struct {
64
64
uint32_t max_etx_update ;
65
65
uint32_t max_etx ;
66
66
uint16_t hysteresis ; // 12 bit fraction
67
+ uint16_t init_etx_sample_count ;
67
68
uint8_t accum_threshold ;
68
69
uint8_t etx_min_sampling_time ;
69
70
uint8_t ext_storage_list_size ;
70
- uint8_t min_sample_count ;
71
- uint8_t init_etx_sample_count ;
71
+ uint8_t min_attempts_count ;
72
72
bool cache_sample_requested ;
73
73
int8_t interface_id ;
74
74
} ext_info_t ;
@@ -81,7 +81,7 @@ static ext_info_t etx_info = {
81
81
.etx_storage_list = NULL ,
82
82
.etx_cache_storage_list = NULL ,
83
83
.ext_storage_list_size = 0 ,
84
- .min_sample_count = 0 ,
84
+ .min_attempts_count = 0 ,
85
85
.max_etx_update = 0 ,
86
86
.max_etx = 0xffff ,
87
87
.init_etx_sample_count = 1 ,
@@ -146,7 +146,6 @@ static void etx_cache_entry_init(uint8_t attribute_index)
146
146
storage -> attempts_count = 0 ;
147
147
storage -> etx_timer = etx_info .etx_min_sampling_time ;
148
148
storage -> received_acks = 0 ;
149
- storage -> sample_count = 0 ;
150
149
}
151
150
152
151
static bool etx_update_possible (etx_sample_storage_t * storage , etx_storage_t * entry , uint16_t time_update )
@@ -161,9 +160,9 @@ static bool etx_update_possible(etx_sample_storage_t *storage, etx_storage_t *en
161
160
162
161
if (entry -> etx_samples > etx_info .init_etx_sample_count ) {
163
162
//Slower ETX update phase
164
- if (storage -> sample_count >= etx_info .min_sample_count ) {
163
+ if (storage -> attempts_count >= etx_info .min_attempts_count ) {
165
164
166
- if (storage -> etx_timer == 0 || storage -> sample_count == 0xff ) {
165
+ if (storage -> etx_timer == 0 || storage -> attempts_count == 0xffff || storage -> received_acks == 0xff ) {
167
166
//Got least min sample in requested time or max possible sample
168
167
return true;
169
168
}
@@ -187,7 +186,6 @@ static etx_sample_storage_t *etx_cache_sample_update(uint8_t attribute_index, ui
187
186
if (ack_rx ) {
188
187
storage -> received_acks ++ ;
189
188
}
190
- storage -> sample_count ++ ;
191
189
return storage ;
192
190
193
191
}
@@ -223,10 +221,6 @@ void etx_transm_attempts_update(int8_t interface_id, uint8_t attempts, bool succ
223
221
etx_sample_storage_t * storage = etx_cache_sample_update (attribute_index , attempts , success );
224
222
entry -> accumulated_failures = 0 ;
225
223
226
- if (!success && entry -> etx_samples < etx_info .init_etx_sample_count ) {
227
- storage -> sample_count = etx_info .init_etx_sample_count ; //Force stop probing if any init fail totally
228
- }
229
-
230
224
if (!etx_update_possible (storage , entry , 0 )) {
231
225
return ;
232
226
}
@@ -613,14 +607,14 @@ bool etx_storage_list_allocate(int8_t interface_id, uint8_t etx_storage_size)
613
607
614
608
}
615
609
616
- bool etx_cached_etx_parameter_set (uint8_t min_wait_time , uint8_t etx_min_sample_count , uint8_t init_etx_sample_count )
610
+ bool etx_cached_etx_parameter_set (uint8_t min_wait_time , uint8_t etx_min_attempts_count , uint8_t init_etx_sample_count )
617
611
{
618
612
//No ini ETX allocation done yet
619
613
if (etx_info .ext_storage_list_size == 0 ) {
620
614
return false;
621
615
}
622
616
623
- if (min_wait_time || etx_min_sample_count ) {
617
+ if (min_wait_time || etx_min_attempts_count ) {
624
618
if (init_etx_sample_count == 0 ) {
625
619
return false;
626
620
}
@@ -647,7 +641,7 @@ bool etx_cached_etx_parameter_set(uint8_t min_wait_time, uint8_t etx_min_sample_
647
641
etx_info .etx_cache_storage_list = NULL ;
648
642
}
649
643
650
- etx_info .min_sample_count = etx_min_sample_count ;
644
+ etx_info .min_attempts_count = etx_min_attempts_count ;
651
645
etx_info .etx_min_sampling_time = min_wait_time ;
652
646
etx_info .init_etx_sample_count = init_etx_sample_count ;
653
647
0 commit comments