Wifi setup function with initial wlan config and per-board unique ssid
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m26s
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 9s

This commit is contained in:
2025-08-05 20:46:19 +02:00
parent 679495bf2b
commit c4a7bb5403

View File

@@ -5,6 +5,7 @@ import aiorepl
import asyncio
import machine
import micropython
import network
import time
from machine import Pin
from math import pi, sin, pow
@@ -52,6 +53,13 @@ machine.mem32[0x4001c004 + 8*4] = 0x67
machine.mem32[0x40030000 + 0x00] = 0x10
def setup_wifi():
network.hostname("TonberryPico")
wlan = network.WLAN(network.WLAN.IF_AP)
wlan.config(ssid=f"TonberryPicoAP_{machine.unique_id().hex()}", security=wlan.SEC_OPEN)
wlan.active(True)
def run():
asyncio.new_event_loop()
# Setup LEDs
@@ -59,6 +67,9 @@ def run():
np = NeoPixel(pin, 10, sm=1)
asyncio.create_task(rainbow(np))
# Wifi with default config
setup_wifi()
# Setup MP3 player
with SDContext(mosi=Pin(3), miso=Pin(4), sck=Pin(2), ss=Pin(5), baudrate=15000000), \
AudioContext(Pin(8), Pin(6)) as audioctx: