esp32,esp8266: Rename WLAN dhcp_hostname config to hostname.

But retain old name for backwards compatibility.
This commit is contained in:
IhorNehrutsa 2022-06-28 16:38:45 +03:00 committed by Damien George
parent 2efaebc899
commit 1ea82b6dcc
3 changed files with 5 additions and 1 deletions

View File

@ -130,7 +130,7 @@ Methods
hidden Whether SSID is hidden (boolean) hidden Whether SSID is hidden (boolean)
security Security protocol supported (enumeration, see module constants) security Security protocol supported (enumeration, see module constants)
key Access key (string) 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) reconnects Number of reconnect attempts to make (integer, 0=none, -1=unlimited)
txpower Maximum transmit power in dBm (integer or float) txpower Maximum transmit power in dBm (integer or float)
============= =========== ============= ===========

View File

@ -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); cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
break; break;
} }
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: { case MP_QSTR_dhcp_hostname: {
const char *s = mp_obj_str_get_str(kwargs->table[i].value); const char *s = mp_obj_str_get_str(kwargs->table[i].value);
esp_exceptions(tcpip_adapter_set_hostname(self->if_id, s)); 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; req_if = WIFI_IF_AP;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel); val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
break; break;
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: { case MP_QSTR_dhcp_hostname: {
const char *s; const char *s;
esp_exceptions(tcpip_adapter_get_hostname(self->if_id, &s)); esp_exceptions(tcpip_adapter_get_hostname(self->if_id, &s));

View File

@ -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); cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
break; break;
} }
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: { case MP_QSTR_dhcp_hostname: {
req_if = STATION_IF; req_if = STATION_IF;
if (self->if_id == 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; req_if = SOFTAP_IF;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel); val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
break; break;
case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: { case MP_QSTR_dhcp_hostname: {
req_if = STATION_IF; req_if = STATION_IF;
char *s = wifi_station_get_hostname(); char *s = wifi_station_get_hostname();