Skip to content

Commit 89e0ae0

Browse files
author
Jarkko Paso
authored
WS: Restart auto CCA threshold after discovery (ARMmbed#2435)
1 parent dbb09b1 commit 89e0ae0

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,10 @@ bool ws_bootstrap_validate_channel_function(ws_us_ie_t *ws_us, ws_bs_ie_t *ws_bs
16391639

16401640
static void ws_bootstrap_asynch_ind(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type)
16411641
{
1642+
// Store weakest heard packet RSSI
1643+
if (cur->ws_info->weakest_received_rssi > data->signal_dbm) {
1644+
cur->ws_info->weakest_received_rssi = data->signal_dbm;
1645+
}
16421646

16431647
if (data->SrcAddrMode != MAC_ADDR_MODE_64_BIT) {
16441648
// Not from long address
@@ -2654,6 +2658,7 @@ static void ws_bootstrap_start_discovery(protocol_interface_info_entry_t *cur)
26542658
cur->nwk_nd_re_scan_count = 0;
26552659
cur->ws_info->configuration_learned = false;
26562660
cur->ws_info->pan_timeout_timer = 0;
2661+
cur->ws_info->weakest_received_rssi = 0;
26572662

26582663
// Clear learned neighbours
26592664
ws_bootstrap_neighbor_list_clean(cur);
@@ -3415,6 +3420,11 @@ void ws_bootstrap_state_machine(protocol_interface_info_entry_t *cur)
34153420
cur->ws_info->trickle_pcs_running = false;
34163421
cur->ws_info->trickle_pc_consistency_block_period = 0;
34173422
ws_fhss_configure(cur, false);
3423+
int8_t new_default = cur->ws_info->weakest_received_rssi - 1;
3424+
if ((new_default < CCA_DEFAULT_DBM) && (new_default >= CCA_LOW_LIMIT) && (new_default <= CCA_HIGH_LIMIT)) {
3425+
// Restart automatic CCA threshold using weakest received RSSI as new default
3426+
mac_helper_start_auto_cca_threshold(cur->id, cur->ws_info->hopping_schdule.number_of_channels, cur->ws_info->weakest_received_rssi - 1, CCA_HIGH_LIMIT, CCA_LOW_LIMIT);
3427+
}
34183428
ws_bootstrap_start_authentication(cur);
34193429
break;
34203430
case ER_RPL_SCAN:

source/6LoWPAN/ws/ws_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ typedef struct ws_info_s {
8484
uint8_t pas_requests; // Amount of PAN solicits sent
8585
uint8_t eapol_tx_index;
8686
uint8_t device_min_sens; // Device min sensitivity set by the application
87+
int8_t weakest_received_rssi; // Weakest received signal (dBm)
8788
parent_info_t parent_info[WS_PARENT_LIST_SIZE];
8889
parent_info_list_t parent_list_free;
8990
parent_info_list_t parent_list_reserved;

source/6LoWPAN/ws/ws_common_defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ typedef struct ws_bs_ie {
332332
/*
333333
* Automatic CCA threshold: default threshold and range in dBm.
334334
*/
335-
#define CCA_DEFAULT_DBM -100
335+
#define CCA_DEFAULT_DBM -60
336336
#define CCA_HIGH_LIMIT -60
337337
#define CCA_LOW_LIMIT -100
338338

0 commit comments

Comments
 (0)