Skip to content

Commit

Permalink
Merge pull request #218 from pimoroni/patch-hostname
Browse files Browse the repository at this point in the history
Make hostname unique per board.
  • Loading branch information
Gadgetoid authored Apr 24, 2024
2 parents f301af3 + 1754dfc commit f4a8f0e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion enviro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f4a8f0e

Please sign in to comment.