fix old bug that was masking new bug

This commit is contained in:
anecdata 2021-11-12 16:27:13 -06:00
parent e4f06f69cd
commit 31d45a3f32
4 changed files with 6 additions and 6 deletions

View File

@ -683,7 +683,7 @@ msgid "Can't set CCCD on local Characteristic"
msgstr "" msgstr ""
#: ports/espressif/common-hal/wifi/Radio.c #: ports/espressif/common-hal/wifi/Radio.c
msgid "Can't set MAC address while connected" msgid "Station must be started"
msgstr "" msgstr ""
#: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c

View File

@ -121,8 +121,8 @@ mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self) {
} }
void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t *mac) { void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t *mac) {
if (self->sta_mode) { if (!self->sta_mode) {
mp_raise_RuntimeError(translate("Can't set MAC address while connected")); mp_raise_RuntimeError(translate("Station must be started"));
} }
if ((mac[0] & 0b1) == 0b1) { if ((mac[0] & 0b1) == 0b1) {
mp_raise_RuntimeError(translate("Invalid multicast MAC address")); mp_raise_RuntimeError(translate("Invalid multicast MAC address"));

View File

@ -152,7 +152,7 @@ void common_hal_wifi_init(void) {
mp_raise_RuntimeError(translate("Failed to init wifi")); mp_raise_RuntimeError(translate("Failed to init wifi"));
} }
// set station mode to avoid the default SoftAP // set station mode to avoid the default SoftAP
esp_wifi_set_mode(WIFI_MODE_STA); common_hal_wifi_radio_start_station(self);
// start wifi // start wifi
common_hal_wifi_radio_set_enabled(self, true); common_hal_wifi_radio_set_enabled(self, true);
} }

View File

@ -118,8 +118,8 @@ const mp_obj_property_t wifi_radio_hostname_obj = {
}; };
//| mac_address: ReadableBuffer //| mac_address: ReadableBuffer
//| """MAC address of the wifi radio station. //| """MAC address for the station. When the address is altered after interface is connected
//| Can only be set while the Station is not started.""" //| the changes would only be reflected once the interface reconnects."""
//| //|
STATIC mp_obj_t wifi_radio_get_mac_address(mp_obj_t self_in) { STATIC mp_obj_t wifi_radio_get_mac_address(mp_obj_t self_in) {
wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in);