|
63 | 63 |
|
64 | 64 | #ifdef HAVE_WS
|
65 | 65 |
|
| 66 | +#define TRIGLE_IMIN_60_SECS (60 * 10) // |
| 67 | + |
66 | 68 | static const trickle_params_t trickle_params_pan_discovery = {
|
67 |
| - .Imin = 60, /* 60 second; ticks are 1s */ |
68 |
| - .Imax = 60 << 4, /* 960 seconds 16 min*/ |
| 69 | + .Imin = TRIGLE_IMIN_60_SECS, /* 60 second; ticks are 1s */ |
| 70 | + .Imax = TRIGLE_IMIN_60_SECS << 4, /* 960 seconds 16 min*/ |
69 | 71 | .k = 1, /* 1 */
|
70 | 72 | .TimerExpirations = TRICKLE_EXPIRATIONS_INFINITE
|
71 | 73 | };
|
@@ -425,7 +427,7 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
|
425 | 427 |
|
426 | 428 | if(ws_neighbor_class_rssi_from_dbm_calculate(data->signal_dbm) < (CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) {
|
427 | 429 | // First neighbor is too low we need to wait one extra trickle
|
428 |
| - cur->bootsrap_state_machine_cnt += trickle_params_pan_discovery.Imin*10 + randLIB_get_8bit() % 50; |
| 430 | + cur->bootsrap_state_machine_cnt += trickle_params_pan_discovery.Imin + randLIB_get_8bit() % 50; |
429 | 431 | }
|
430 | 432 | }
|
431 | 433 |
|
@@ -1120,7 +1122,7 @@ static void ws_bootstrap_start_discovery(protocol_interface_info_entry_t *cur)
|
1120 | 1122 | trickle_inconsistent_heard(&cur->ws_info->trickle_pan_advertisement_solicit, &trickle_params_pan_discovery);
|
1121 | 1123 |
|
1122 | 1124 | // Discovery statemachine is checkked after two trickle interval
|
1123 |
| - cur->bootsrap_state_machine_cnt = 2*trickle_params_pan_discovery.Imin*10 + randLIB_get_8bit() % 50; |
| 1125 | + cur->bootsrap_state_machine_cnt = 2*trickle_params_pan_discovery.Imin + randLIB_get_8bit() % 50; |
1124 | 1126 | }
|
1125 | 1127 | // Start configuration learning
|
1126 | 1128 | static void ws_bootstrap_start_configuration_learn(protocol_interface_info_entry_t *cur)
|
@@ -1418,7 +1420,7 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur)
|
1418 | 1420 |
|
1419 | 1421 | if (!ws_bootstrap_network_found(cur)) {
|
1420 | 1422 | // Next check will be after one trickle
|
1421 |
| - cur->bootsrap_state_machine_cnt += trickle_params_pan_discovery.Imin*10 + randLIB_get_8bit() % 50; |
| 1423 | + cur->bootsrap_state_machine_cnt += trickle_params_pan_discovery.Imin + randLIB_get_8bit() % 50; |
1422 | 1424 | return;
|
1423 | 1425 | }
|
1424 | 1426 | tr_info("select network");
|
@@ -1524,34 +1526,41 @@ void ws_bootstrap_state_machine(protocol_interface_info_entry_t *cur)
|
1524 | 1526 |
|
1525 | 1527 | }
|
1526 | 1528 | }
|
1527 |
| -void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds) |
| 1529 | + |
| 1530 | +void ws_bootstrap_trigle_timer(protocol_interface_info_entry_t *cur, uint16_t ticks) |
1528 | 1531 | {
|
1529 |
| - if(trickle_timer(&cur->ws_info->trickle_pan_advertisement_solicit, &trickle_params_pan_discovery, seconds)) { |
| 1532 | + if(trickle_timer(&cur->ws_info->trickle_pan_advertisement_solicit, &trickle_params_pan_discovery, ticks)) { |
1530 | 1533 | // send PAN advertisement solicit
|
1531 | 1534 | tr_info("Send PAN advertisement Solicit");
|
1532 | 1535 | ws_bootstrap_pan_advert_solicit(cur);
|
1533 | 1536 | }
|
1534 |
| - if(trickle_timer(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_discovery, seconds)) { |
| 1537 | + if(trickle_timer(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_discovery, ticks)) { |
1535 | 1538 | // send PAN Configuration solicit
|
1536 | 1539 | if (cur->ws_info->pas_requests > PCS_MAX) {
|
1537 | 1540 | // if MAX PCS sent restart discovery
|
| 1541 | + tr_debug("Restart???"); |
1538 | 1542 | ws_bootstrap_event_discovery_start(cur);
|
1539 | 1543 | return;
|
1540 | 1544 | }
|
1541 | 1545 | tr_info("Send PAN configuration Solicit");
|
1542 | 1546 | cur->ws_info->pas_requests++;
|
1543 | 1547 | ws_bootstrap_pan_config_solicit(cur);
|
1544 | 1548 | }
|
1545 |
| - if(trickle_timer(&cur->ws_info->trickle_pan_advertisement, &trickle_params_pan_discovery, seconds)) { |
| 1549 | + if(trickle_timer(&cur->ws_info->trickle_pan_advertisement, &trickle_params_pan_discovery, ticks)) { |
1546 | 1550 | // send PAN advertisement
|
1547 | 1551 | tr_info("Send PAN advertisement");
|
1548 | 1552 | ws_bootstrap_pan_advert(cur);
|
1549 | 1553 | }
|
1550 |
| - if(trickle_timer(&cur->ws_info->trickle_pan_config, &trickle_params_pan_discovery, seconds)) { |
| 1554 | + if(trickle_timer(&cur->ws_info->trickle_pan_config, &trickle_params_pan_discovery, ticks)) { |
1551 | 1555 | // send PAN Configuration
|
1552 | 1556 | tr_info("Send PAN configuration");
|
1553 | 1557 | ws_bootstrap_pan_config(cur);
|
1554 | 1558 | }
|
| 1559 | +} |
| 1560 | + |
| 1561 | + |
| 1562 | +void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds) |
| 1563 | +{ |
1555 | 1564 | if (cur->ws_info->pan_version_timeout_timer){
|
1556 | 1565 | // PAN version timer running
|
1557 | 1566 | if (cur->ws_info->pan_version_timeout_timer > seconds ) {
|
|
0 commit comments