Skip to content

Commit 1ea82b6

Browse files
IhorNehrutsadpgeorge
authored andcommitted
esp32,esp8266: Rename WLAN dhcp_hostname config to hostname.
But retain old name for backwards compatibility.
1 parent 2efaebc commit 1ea82b6

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

docs/library/network.WLAN.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Methods
130130
hidden Whether SSID is hidden (boolean)
131131
security Security protocol supported (enumeration, see module constants)
132132
key Access key (string)
133-
dhcp_hostname The DHCP hostname to use
133+
hostname The hostname that will be sent to DHCP (STA interfaces) and mDNS (if supported, both STA and AP)
134134
reconnects Number of reconnect attempts to make (integer, 0=none, -1=unlimited)
135135
txpower Maximum transmit power in dBm (integer or float)
136136
============= ===========

ports/esp32/network_wlan.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ STATIC mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_
452452
cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
453453
break;
454454
}
455+
case MP_QSTR_hostname:
455456
case MP_QSTR_dhcp_hostname: {
456457
const char *s = mp_obj_str_get_str(kwargs->table[i].value);
457458
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_
538539
req_if = WIFI_IF_AP;
539540
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
540541
break;
542+
case MP_QSTR_hostname:
541543
case MP_QSTR_dhcp_hostname: {
542544
const char *s;
543545
esp_exceptions(tcpip_adapter_get_hostname(self->if_id, &s));

ports/esp8266/modnetwork.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
397397
cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
398398
break;
399399
}
400+
case MP_QSTR_hostname:
400401
case MP_QSTR_dhcp_hostname: {
401402
req_if = STATION_IF;
402403
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
461462
req_if = SOFTAP_IF;
462463
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
463464
break;
465+
case MP_QSTR_hostname:
464466
case MP_QSTR_dhcp_hostname: {
465467
req_if = STATION_IF;
466468
char *s = wifi_station_get_hostname();

0 commit comments

Comments
 (0)