mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #2169 from openmv/cyw43_sec_mode
ports/all: Fix WiFi AP mode issues.
This commit is contained in:
commit
68296674e9
@ -15,8 +15,9 @@ PORT = 8080 # Arbitrary non-privileged port
|
|||||||
|
|
||||||
# Init wlan module and connect to network
|
# Init wlan module and connect to network
|
||||||
wlan = network.WLAN(network.AP_IF)
|
wlan = network.WLAN(network.AP_IF)
|
||||||
|
wlan.config(ssid=SSID, key=KEY, channel=2)
|
||||||
wlan.active(True)
|
wlan.active(True)
|
||||||
wlan.config(essid=SSID, key=KEY, security=wlan.WEP, channel=2)
|
|
||||||
print("AP mode started. SSID: {} IP: {}".format(SSID, wlan.ifconfig()[0]))
|
print("AP mode started. SSID: {} IP: {}".format(SSID, wlan.ifconfig()[0]))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,9 +25,9 @@ sensor.set_pixformat(sensor.GRAYSCALE)
|
|||||||
|
|
||||||
# Init wlan module in AP mode.
|
# Init wlan module in AP mode.
|
||||||
wlan = network.WLAN(network.AP_IF)
|
wlan = network.WLAN(network.AP_IF)
|
||||||
|
wlan.config(ssid=SSID, key=KEY, channel=2)
|
||||||
wlan.active(True)
|
wlan.active(True)
|
||||||
# Note some WiFi modules only support WEP in AP mode.
|
|
||||||
wlan.config(ssid=SSID, key=KEY, channel=2) # security=wlan.WEP
|
|
||||||
print("AP mode started. SSID: {} IP: {}".format(SSID, wlan.ifconfig()[0]))
|
print("AP mode started. SSID: {} IP: {}".format(SSID, wlan.ifconfig()[0]))
|
||||||
|
|
||||||
# You can block waiting for client to connect
|
# You can block waiting for client to connect
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 99baee47ded6c52b2ff1881cb278def56fe8dd0d
|
Subproject commit 07e3a4c5ad8c29d72619439673e5de7c95c84ad1
|
||||||
@ -135,6 +135,7 @@ soft_reset:
|
|||||||
memcpy(&buf[0], "PYBD", 4);
|
memcpy(&buf[0], "PYBD", 4);
|
||||||
mp_hal_get_mac_ascii(MP_HAL_MAC_WLAN0, 8, 4, (char *) &buf[4]);
|
mp_hal_get_mac_ascii(MP_HAL_MAC_WLAN0, 8, 4, (char *) &buf[4]);
|
||||||
cyw43_wifi_ap_set_ssid(&cyw43_state, 8, buf);
|
cyw43_wifi_ap_set_ssid(&cyw43_state, 8, buf);
|
||||||
|
cyw43_wifi_ap_set_auth(&cyw43_state, CYW43_AUTH_WPA2_AES_PSK);
|
||||||
cyw43_wifi_ap_set_password(&cyw43_state, 8, (const uint8_t *) "pybd0123");
|
cyw43_wifi_ap_set_password(&cyw43_state, 8, (const uint8_t *) "pybd0123");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -348,6 +348,7 @@ soft_reset:
|
|||||||
memcpy(&buf[0], "PYBD", 4);
|
memcpy(&buf[0], "PYBD", 4);
|
||||||
mp_hal_get_mac_ascii(MP_HAL_MAC_WLAN0, 8, 4, (char *) &buf[4]);
|
mp_hal_get_mac_ascii(MP_HAL_MAC_WLAN0, 8, 4, (char *) &buf[4]);
|
||||||
cyw43_wifi_ap_set_ssid(&cyw43_state, 8, buf);
|
cyw43_wifi_ap_set_ssid(&cyw43_state, 8, buf);
|
||||||
|
cyw43_wifi_ap_set_auth(&cyw43_state, CYW43_AUTH_WPA2_AES_PSK);
|
||||||
cyw43_wifi_ap_set_password(&cyw43_state, 8, (const uint8_t *) "pybd0123");
|
cyw43_wifi_ap_set_password(&cyw43_state, 8, (const uint8_t *) "pybd0123");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -160,6 +160,12 @@ static mp_obj_t py_winc_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_m
|
|||||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Key can't be empty!"));
|
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Key can't be empty!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Activate the interface if it's inactive.
|
||||||
|
if (!self->active) {
|
||||||
|
mp_obj_t args[2] = { pos_args[0], MP_OBJ_NEW_SMALL_INT(1) };
|
||||||
|
py_winc_active(2, args);
|
||||||
|
}
|
||||||
|
|
||||||
if (self->itf == WINC_MODE_STA) {
|
if (self->itf == WINC_MODE_STA) {
|
||||||
// Initialize WiFi in STA mode.
|
// Initialize WiFi in STA mode.
|
||||||
if (winc_connect(ssid, security, key, M2M_WIFI_CH_ALL) != 0) {
|
if (winc_connect(ssid, security, key, M2M_WIFI_CH_ALL) != 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user