Skip to content

Commit

Permalink
Wi-SUN fhss API default value setting fixes
Browse files Browse the repository at this point in the history
documented the default parameter functionality
  • Loading branch information
Mika committed Oct 16, 2020
1 parent 164a370 commit 7a8b2bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions nanostack/ws_management_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ int ws_management_channel_plan_set(
*
* Change the default configuration for Wi-SUN FHSS operation.
*
* Calling with fhss_uc_dwell_interval = 0, fhss_broadcast_interval = 0xffffffff,
* fhss_bc_dwell_interval = 0 restores stack defaults
*
* \param interface_id Network interface ID.
* \param fhss_uc_dwell_interval default to 250 ms.
Expand All @@ -403,6 +405,7 @@ int ws_management_fhss_timing_configure(
* Change the default configuration for Wi-SUN FHSS operation.
* if application defined is used the behaviour is undefined
*
* Calling with dwell_interval = 0, channel_function = 0xff, fixed_channel = 0xffff restores stack defaults
*
* \param interface_id Network interface ID.
* \param channel_function Unicast channel function.
Expand Down Expand Up @@ -458,6 +461,8 @@ int ws_management_fhss_unicast_channel_function_validate(
* Change the default configuration for Wi-SUN FHSS operation.
* if application defined is used the behaviour is undefined
*
* Calling with dwell_interval = 0, channel_function = 0xff,
* broadcast_interval = 0xffffffff, fixed_channel = 0xffff restores stack defaults
*
* \param interface_id Network interface ID.
* \param channel_function Broadcast channel function.
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/ws/ws_cfg_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ int8_t ws_cfg_fhss_validate(ws_fhss_cfg_t *cfg, ws_fhss_cfg_t *new_cfg)
return CFG_SETTINGS_ERROR_FHSS_CONF;
}

if (new_cfg->fhss_bc_dwell_interval < 15) {
if (new_cfg->fhss_bc_dwell_interval < 100) {
return CFG_SETTINGS_ERROR_FHSS_CONF;
}

Expand Down
16 changes: 8 additions & 8 deletions source/6LoWPAN/ws/ws_management_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ int ws_management_fhss_timing_configure(
return -2;
}

if (fhss_uc_dwell_interval == 0xff) {
if (fhss_uc_dwell_interval == 0) {
cfg.fhss_uc_dwell_interval = cfg_default.fhss_uc_dwell_interval;
} else if (fhss_uc_dwell_interval > 0) {
} else {
cfg.fhss_uc_dwell_interval = fhss_uc_dwell_interval;
}

Expand All @@ -473,9 +473,9 @@ int ws_management_fhss_timing_configure(
cfg.fhss_bc_interval = fhss_broadcast_interval;
}

if (fhss_bc_dwell_interval == 0xff) {
if (fhss_bc_dwell_interval == 0) {
cfg.fhss_bc_dwell_interval = cfg_default.fhss_bc_dwell_interval;
} else if (fhss_bc_dwell_interval > 0) {
} else {
cfg.fhss_bc_dwell_interval = fhss_bc_dwell_interval;
}

Expand Down Expand Up @@ -509,9 +509,9 @@ int ws_management_fhss_unicast_channel_function_configure(
return -2;
}

if (dwell_interval == 0xff) {
if (dwell_interval == 0) {
cfg.fhss_uc_dwell_interval = cfg_default.fhss_uc_dwell_interval;
} else if (dwell_interval > 0) {
} else {
cfg.fhss_uc_dwell_interval = dwell_interval;
}
if (channel_function < 0xff) {
Expand Down Expand Up @@ -611,9 +611,9 @@ int ws_management_fhss_broadcast_channel_function_configure(
return -2;
}

if (dwell_interval == 0xff) {
if (dwell_interval == 0) {
cfg.fhss_bc_dwell_interval = cfg_default.fhss_bc_dwell_interval;
} else if (dwell_interval > 0) {
} else {
cfg.fhss_bc_dwell_interval = dwell_interval;
}

Expand Down

0 comments on commit 7a8b2bf

Please sign in to comment.