summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--cc3200/mods/modwlan.c25
-rw-r--r--cc3200/mptask.c2
-rw-r--r--cc3200/serverstask.h1
3 files changed, 14 insertions, 14 deletions
diff --git a/cc3200/mods/modwlan.c b/cc3200/mods/modwlan.c
index a869f1a88d..6cb1ec21d6 100644
--- a/cc3200/mods/modwlan.c
+++ b/cc3200/mods/modwlan.c
@@ -362,6 +362,12 @@ modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ss
const char *key, uint8_t key_len, uint8_t channel) {
if (mode == ROLE_STA || mode == ROLE_AP || mode == ROLE_P2P) {
+#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
+ // Stop all other processes using the wlan engine
+ if ((wlan_obj.servers_enabled = servers_are_enabled())) {
+ wlan_stop_servers();
+ }
+#endif
if (wlan_obj.mode < 0) {
wlan_obj.mode = sl_Start(0, 0, 0);
sl_LockObjUnlock (&wlan_LockObj);
@@ -486,6 +492,12 @@ modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ss
wlan_reenable(mode);
}
}
+#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
+ // Start the servers again
+ if (wlan_obj.servers_enabled) {
+ servers_enable();
+ }
+#endif
return MODWLAN_OK;
}
return MODWLAN_ERROR_INVALID_PARAMS;
@@ -674,13 +686,6 @@ STATIC mp_obj_t wlan_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k
if (n_args > 0) {
// Get the mode
SlWlanMode_t mode = mp_obj_get_int(args[0]);
-
-#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
- // Stop all other processes using the wlan engine
- if ((wlan_obj.servers_enabled = servers_are_enabled())) {
- wlan_stop_servers();
- }
-#endif
if (mode == ROLE_AP) {
// start the peripheral
mp_map_t kw_args;
@@ -696,12 +701,6 @@ STATIC mp_obj_t wlan_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k
else {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, mpexception_num_type_invalid_arguments));
}
-#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
- // Start the servers again
- if (wlan_obj.servers_enabled) {
- servers_enable();
- }
-#endif
} else if (wlan_obj.mode < 0) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, mpexception_num_type_invalid_arguments));
}
diff --git a/cc3200/mptask.c b/cc3200/mptask.c
index 733191969c..f97c07b50f 100644
--- a/cc3200/mptask.c
+++ b/cc3200/mptask.c
@@ -319,7 +319,7 @@ STATIC void main_init_sflash_filesystem (void) {
STATIC void main_enter_ap_mode (void) {
// Enable simplelink in low power mode
- wlan_sl_enable (ROLE_AP, SERVERS_DEF_AP_SSID, strlen(SERVERS_DEF_AP_SSID), SL_SEC_TYPE_WPA_WPA2,
+ wlan_sl_enable (ROLE_AP, SERVERS_DEF_AP_SSID, strlen(SERVERS_DEF_AP_SSID), SERVERS_DEF_AP_SECURITY,
SERVERS_DEF_AP_KEY, strlen(SERVERS_DEF_AP_KEY), SERVERS_DEF_AP_CHANNEL);
wlan_set_pm_policy (SL_NORMAL_POLICY);
}
diff --git a/cc3200/serverstask.h b/cc3200/serverstask.h
index 264a328a87..9a25b8a3b1 100644
--- a/cc3200/serverstask.h
+++ b/cc3200/serverstask.h
@@ -40,6 +40,7 @@
#define SERVERS_PASS_LEN_MAX 16
#define SERVERS_DEF_AP_SSID "micropy-wlan"
+#define SERVERS_DEF_AP_SECURITY SL_SEC_TYPE_WPA_WPA2
#define SERVERS_DEF_AP_KEY "micropython"
#define SERVERS_DEF_AP_CHANNEL 6