Skip to content

Commit 639f9db

Browse files
author
Jarkko Paso
authored
FHSS: Changed retry backoffs when no BC schedule or TX slots (ARMmbed#2440)
1 parent 4192cc8 commit 639f9db

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -859,13 +859,13 @@ static uint32_t fhss_ws_get_retry_period_callback(const fhss_api_t *api, uint8_t
859859
if (!fhss_structure) {
860860
return return_value;
861861
}
862-
// We don't know the broadcast schedule, use large backoff with MAC retries
862+
// We don't know the broadcast schedule, use randomised large backoff with MAC retries
863863
if (fhss_structure->ws->broadcast_timer_running == false) {
864-
return 100000;
864+
return (uint32_t) randLIB_get_random_in_range(20000, 45000);
865865
}
866866
// We don't know the TX/RX slots, use randomised large backoff with MAC retries
867867
if (fhss_structure->own_hop == 0xff) {
868-
return ((uint32_t) randLIB_get_random_in_range(50, 150) * 1000);
868+
return (uint32_t) randLIB_get_random_in_range(20000, 45000);
869869
}
870870
if (fhss_structure->ws->is_on_bc_channel == true) {
871871
return return_value;

test/nanostack/unittest/service_libs/fhss_ws/test_fhss_ws.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,8 @@ bool test_fhss_ws_get_retry_period_callback()
566566
// Test when own hop not set
567567
fhss_common_stub.fhss_struct.ws->is_on_bc_channel = false;
568568
fhss_common_stub.fhss_struct.own_hop = 0xff;
569-
if (fhss_common_stub.fhss_struct.fhss_api->get_retry_period(api, NULL, 0) != 100000) {
569+
uint32_t retry_period = fhss_common_stub.fhss_struct.fhss_api->get_retry_period(api, NULL, 0);
570+
if (retry_period < 20000 || retry_period > 45000) {
570571
return false;
571572
}
572573
// Test when on broadcast channel

0 commit comments

Comments
 (0)