I've modified network_wlan.c to get the number of clients connected in AP mode.
I've added the following code into network_wlan_config function here:
https://github.com/micropython/micropyt ... lan.c#L537
Code: Select all
case QS(MP_QSTR_connected_clients):
req_if = WIFI_IF_AP;
val = MP_OBJ_NEW_SMALL_INT(ap_connected_client_count);
Code: Select all
>>> import network
>>> ap = network.WLAN(network.AP_IF)
>>> ap.config('connected_clients')
0
To try and debug things, I also added a line that prints the value of the qsrt passed in:
Code: Select all
ESP_LOGI("wifi", "got param %d", (uintptr_t)args[1]);
Code: Select all
I (16557) wifi: got param 2074
Code: Select all
I (947) wifi: got param 1061406248
ap.config('mac')
and this works both in the REPL and from _boot.py. In both cases I log:
Code: Select all
I (307417) wifi: got param 6738
[edit -- additional]
Just compiled latest esp32 from micropython github repo and added the following under _boot.py
Code: Select all
import network
ap = network.WLAN(network.AP_IF)
print(ap.config('mac'))
print(ap.config('dhcp_hostname'))
Code: Select all
b'\xd8\xa0\x1deh\x1d'
Traceback (most recent call last):
File "_boot.py", line 18, in <module>
ValueError: unknown config param
MicroPython v1.17-217-gde7e3cd79-dirty on 2021-11-30; ESP32 module with ESP32
Type "help()" for more information.