Skip to content

Commit

Permalink
FHSS: Changed retry backoffs when no BC schedule or TX slots (ARMmbed…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarkko Paso authored Sep 2, 2020
1 parent 4192cc8 commit 639f9db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions source/Service_Libs/fhss/fhss_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,13 +859,13 @@ static uint32_t fhss_ws_get_retry_period_callback(const fhss_api_t *api, uint8_t
if (!fhss_structure) {
return return_value;
}
// We don't know the broadcast schedule, use large backoff with MAC retries
// We don't know the broadcast schedule, use randomised large backoff with MAC retries
if (fhss_structure->ws->broadcast_timer_running == false) {
return 100000;
return (uint32_t) randLIB_get_random_in_range(20000, 45000);
}
// We don't know the TX/RX slots, use randomised large backoff with MAC retries
if (fhss_structure->own_hop == 0xff) {
return ((uint32_t) randLIB_get_random_in_range(50, 150) * 1000);
return (uint32_t) randLIB_get_random_in_range(20000, 45000);
}
if (fhss_structure->ws->is_on_bc_channel == true) {
return return_value;
Expand Down
3 changes: 2 additions & 1 deletion test/nanostack/unittest/service_libs/fhss_ws/test_fhss_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ bool test_fhss_ws_get_retry_period_callback()
// Test when own hop not set
fhss_common_stub.fhss_struct.ws->is_on_bc_channel = false;
fhss_common_stub.fhss_struct.own_hop = 0xff;
if (fhss_common_stub.fhss_struct.fhss_api->get_retry_period(api, NULL, 0) != 100000) {
uint32_t retry_period = fhss_common_stub.fhss_struct.fhss_api->get_retry_period(api, NULL, 0);
if (retry_period < 20000 || retry_period > 45000) {
return false;
}
// Test when on broadcast channel
Expand Down

0 comments on commit 639f9db

Please sign in to comment.