Skip to content

Commit 31d45a3

Browse files
committed
fix old bug that was masking new bug
1 parent e4f06f6 commit 31d45a3

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

locale/circuitpython.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ msgid "Can't set CCCD on local Characteristic"
683683
msgstr ""
684684

685685
#: ports/espressif/common-hal/wifi/Radio.c
686-
msgid "Can't set MAC address while connected"
686+
msgid "Station must be started"
687687
msgstr ""
688688

689689
#: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c

ports/espressif/common-hal/wifi/Radio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self) {
121121
}
122122

123123
void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t *mac) {
124-
if (self->sta_mode) {
125-
mp_raise_RuntimeError(translate("Can't set MAC address while connected"));
124+
if (!self->sta_mode) {
125+
mp_raise_RuntimeError(translate("Station must be started"));
126126
}
127127
if ((mac[0] & 0b1) == 0b1) {
128128
mp_raise_RuntimeError(translate("Invalid multicast MAC address"));

ports/espressif/common-hal/wifi/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void common_hal_wifi_init(void) {
152152
mp_raise_RuntimeError(translate("Failed to init wifi"));
153153
}
154154
// set station mode to avoid the default SoftAP
155-
esp_wifi_set_mode(WIFI_MODE_STA);
155+
common_hal_wifi_radio_start_station(self);
156156
// start wifi
157157
common_hal_wifi_radio_set_enabled(self, true);
158158
}

shared-bindings/wifi/Radio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ const mp_obj_property_t wifi_radio_hostname_obj = {
118118
};
119119

120120
//| mac_address: ReadableBuffer
121-
//| """MAC address of the wifi radio station.
122-
//| Can only be set while the Station is not started."""
121+
//| """MAC address for the station. When the address is altered after interface is connected
122+
//| the changes would only be reflected once the interface reconnects."""
123123
//|
124124
STATIC mp_obj_t wifi_radio_get_mac_address(mp_obj_t self_in) {
125125
wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in);

0 commit comments

Comments
 (0)