Browse Source

esp32,esp8266: Rename WLAN dhcp_hostname config to hostname.

But retain old name for backwards compatibility.
pull/8878/head
IhorNehrutsa 2 years ago
committed by Damien George
parent
commit
1ea82b6dcc
  1. 2
      docs/library/network.WLAN.rst
  2. 2
      ports/esp32/network_wlan.c
  3. 2
      ports/esp8266/modnetwork.c

2
docs/library/network.WLAN.rst

@ -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
ports/esp32/network_wlan.c

@ -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));
@ -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));

2
ports/esp8266/modnetwork.c

@ -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) {
@ -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();

Loading…
Cancel
Save