--- a/src/eric7/MicroPython/Devices/MCUScripts/esp32WiFiConnect.py Wed Aug 02 17:22:20 2023 +0200 +++ b/src/eric7/MicroPython/Devices/MCUScripts/esp32WiFiConnect.py Thu Aug 03 17:33:07 2023 +0200 @@ -10,13 +10,30 @@ ssid = buf[:size].decode() size = nvs.get_blob("password", buf) password = buf[:size].decode() + size = nvs.get_blob("hostname", buf) + hostname = buf[:size].decode() + size = nvs.get_blob("country", buf) + country = buf[:size].decode() + + print("Connecting WiFi to '{0}'...".format(ssid)) + + if country: + try: + network.country(country) + except AttributeError: + pass + + if hostname: + try: + network.hostname(hostname) + except AttributeError: + pass wifi = network.WLAN(network.STA_IF) wifi.active(False) wifi.active(True) wifi.connect(ssid, password) max_wait = 140 - print("Connecting WiFi to '{0}'...".format(ssid)) while max_wait and wifi.status() == network.STAT_CONNECTING: max_wait -= 1 sleep(0.1)