Skip to content
Snippets Groups Projects
Commit 27fa9881 authored by Damien George's avatar Damien George
Browse files

esp32/modnetwork: Implement dhcp_hostname for WLAN.config().

parent 4e469085
No related branches found
No related tags found
No related merge requests found
......@@ -445,6 +445,11 @@ 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 QS(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));
break;
}
default:
goto unknown;
}
......@@ -494,6 +499,12 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
req_if = WIFI_IF_AP;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
break;
case QS(MP_QSTR_dhcp_hostname): {
const char *s;
ESP_EXCEPTIONS(tcpip_adapter_get_hostname(self->if_id, &s));
val = mp_obj_new_str(s, strlen(s));
break;
}
default:
goto unknown;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment