diff --git a/enviro/__init__.py b/enviro/__init__.py index 72d6df8..17fa3a4 100644 --- a/enviro/__init__.py +++ b/enviro/__init__.py @@ -153,7 +153,7 @@ def stop_activity_led(): print(" - -- ---- -----=--==--=== hey enviro, let's go! ===--==--=----- ---- -- - ") print("") -def reconnect_wifi(ssid, password, country): +def reconnect_wifi(ssid, password, country, hostname=None): import time import network import math @@ -165,6 +165,11 @@ def reconnect_wifi(ssid, password, country): # Set country rp2.country(country) + # Set hostname + if hostname is None: + hostname = f"EnviroW-{helpers.uid()[-4:]}" + network.hostname(hostname) + # Reference: https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf CYW43_LINK_DOWN = 0 CYW43_LINK_JOIN = 1