Skip to content

Commit

Permalink
Corrected nw size set on automatic mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Mika Leppänen committed Feb 23, 2021
1 parent 65e6c2d commit 77a76c7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/6LoWPAN/ws/ws_cfg_settings.c
Expand Up @@ -301,6 +301,8 @@ int8_t ws_cfg_network_size_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_
set_function(&nw_size_cfg);
}

uint8_t cfg_network_size = cfg->network_size;

/* If no longer in an automatic network size mode, frees automatic configuration,
so that new configuration is set */
if (nw_size_external_cfg && old_network_size == NETWORK_SIZE_AUTOMATIC) {
Expand All @@ -309,7 +311,7 @@ int8_t ws_cfg_network_size_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_
}

uint8_t set_flags = 0;
if (cfg->network_size == NETWORK_SIZE_AUTOMATIC) {
if (cfg_network_size == NETWORK_SIZE_AUTOMATIC) {
set_flags = CFG_FLAGS_DISABLE_VAL_SET;
}
/* Sets values if changed or network size has been previously automatic (to make sure
Expand All @@ -336,7 +338,7 @@ int8_t ws_cfg_network_size_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_
}

// If is in an automatic network size mode, updates automatic configuration
if (cfg->network_size == NETWORK_SIZE_AUTOMATIC && cur) {
if (cfg_network_size == NETWORK_SIZE_AUTOMATIC && cur) {
ws_cfg_network_size_configure(cur, cur->ws_info->pan_information.pan_size);
}
return CFG_SETTINGS_OK;
Expand Down Expand Up @@ -693,6 +695,7 @@ int8_t ws_cfg_gen_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_t *cfg, w
}
ws_cfg_trace((ws_cfgs_t *) cfg, (ws_cfgs_t *) new_cfg, sizeof(ws_gen_cfg_t), "gen");

cfg->network_size = new_cfg->network_size;
if (&cfg->network_name != &new_cfg->network_name) {
strncpy(cfg->network_name, new_cfg->network_name, 32);
}
Expand Down

0 comments on commit 77a76c7

Please sign in to comment.