Skip to content

Commit b6bdb0d

Browse files
author
Daniel Campora
committed
cc3200: Always reset WLAN after setting the mode.
1 parent ed6a5b7 commit b6bdb0d

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

cc3200/mods/modwlan.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,24 +443,24 @@ void wlan_sl_init (int8_t mode, const char *ssid, uint8_t ssid_len, uint8_t auth
443443
memset(RxFilterIdMask.FilterIdMask, 0xFF, 8);
444444
ASSERT_ON_ERROR(sl_WlanRxFilterSet(SL_REMOVE_RX_FILTER, (_u8 *)&RxFilterIdMask, sizeof(_WlanRxFilterOperationCommandBuff_t)));
445445

446-
// switch to the requested mode
447-
wlan_set_mode(mode);
448-
449446
#if MICROPY_HW_ANTENNA_DIVERSITY
450447
// set the antenna type
451448
wlan_set_antenna (antenna);
452449
#endif
453450

451+
// switch to the requested mode
452+
wlan_set_mode(mode);
453+
454+
// stop and start again (we need to in the propper mode from now on)
455+
wlan_reenable(mode);
456+
454457
// Set Tx power level for station or AP mode
455458
// Number between 0-15, as dB offset from max power - 0 will set max power
456459
uint8_t ucPower = 0;
457460
if (mode == ROLE_AP) {
458461
ASSERT_ON_ERROR(sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_AP_TX_POWER, sizeof(ucPower),
459462
(unsigned char *)&ucPower));
460463

461-
// stop and start again (we need to be in AP mode in order to continue)
462-
wlan_reenable(mode);
463-
464464
// configure all parameters
465465
wlan_set_ssid (ssid, ssid_len, add_mac);
466466
wlan_set_security (auth, key, key_len);
@@ -492,8 +492,6 @@ void wlan_sl_init (int8_t mode, const char *ssid, uint8_t ssid_len, uint8_t auth
492492
} else { // STA and P2P modes
493493
ASSERT_ON_ERROR(sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,
494494
sizeof(ucPower), (unsigned char *)&ucPower));
495-
// stop and start again
496-
wlan_reenable(mode);
497495
// set connection policy to Auto + Fast (tries to connect to the last connected AP)
498496
ASSERT_ON_ERROR(sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1, 1, 0, 0, 0), NULL, 0));
499497
}

0 commit comments

Comments
 (0)