Missing country settings for ESP WIFI
In micropython, there is no way to define in which country the ESP WIFI transmitters operate.
This might create legal problems for anyone using the ESP devices and micropython "out of the box".
The ESP-IDF function call is esp_wifi_set_country(), described in https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#wi-fi-country-code.
Current uPy sources have no call to esp_wifi_set_country() - I searched *.[hc] for it.
The issue had been discussed in https://forum.micropython.org/viewtopic.php?f=18&t=10388
docs: network.WLAN in STA_IF mode: which parameters are persistent?
I hit the problem on esp8266, but it is primarly a lack of documentation.
Example: this basic code to init the micro as Wifi client:
network.country("it")
WIFI = network.WLAN(network.STA_IF)
WIFI.config(dhcp_hostname = "test")
WIFI.connect(ssid, pwd)
From the docs I read
ESP8266 automatically reconnects to the last Access Point when STA_IF is active, even after reboot/reset
Indeed after a reboot the ESP will auto-reconnect the the access point.
But
-
It has lost the hostname: in the router I see the factory default "ESP_xxx" (where xxx seems to be the machine unique id).
-
I don't know about the country setting, if it is persistent between reboots.
I haven't the radio equiment to check the esp radio emissions, regarding WiFi compliance to national requirements.
Questions:
- Is it confirmed the esp8266 store only the SSID and password ?
- Is this a behaviour of the esp8266 of also on other micros, like esp32 ?
- At power up, is it possible to mantain the working WiFi connection and set the hostname?
- which country codes are supported by network.country() ?
I cannot find hints.
Please anybody point me to the docs - - or how can we improve the existing ones.