Skip to content

Commit

Permalink
esp32,esp8266: Rename WLAN dhcp_hostname config to hostname.
Browse files Browse the repository at this point in the history
But retain old name for backwards compatibility.
  • Loading branch information
IhorNehrutsa authored and dpgeorge committed Jul 5, 2022
1 parent 2efaebc commit 1ea82b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/library/network.WLAN.rst
Expand Up @@ -130,7 +130,7 @@ Methods
hidden Whether SSID is hidden (boolean)
security Security protocol supported (enumeration, see module constants)
key Access key (string)
dhcp_hostname The DHCP hostname to use
hostname The hostname that will be sent to DHCP (STA interfaces) and mDNS (if supported, both STA and AP)
reconnects Number of reconnect attempts to make (integer, 0=none, -1=unlimited)
txpower Maximum transmit power in dBm (integer or float)
============= ===========
2 changes: 2 additions & 0 deletions ports/esp32/network_wlan.c
Expand Up @@ -452,6 +452,7 @@ STATIC mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_
cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
break;
}
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {
const char *s = mp_obj_str_get_str(kwargs->table[i].value);
esp_exceptions(tcpip_adapter_set_hostname(self->if_id, s));
Expand Down Expand Up @@ -538,6 +539,7 @@ STATIC mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_
req_if = WIFI_IF_AP;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
break;
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {
const char *s;
esp_exceptions(tcpip_adapter_get_hostname(self->if_id, &s));
Expand Down
2 changes: 2 additions & 0 deletions ports/esp8266/modnetwork.c
Expand Up @@ -397,6 +397,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
break;
}
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {
req_if = STATION_IF;
if (self->if_id == STATION_IF) {
Expand Down Expand Up @@ -461,6 +462,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
req_if = SOFTAP_IF;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
break;
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {
req_if = STATION_IF;
char *s = wifi_station_get_hostname();
Expand Down

0 comments on commit 1ea82b6

Please sign in to comment.