From 8b6bbdeb56e18a2eceafd2571f8218c43d7af68b Mon Sep 17 00:00:00 2001 From: jimmy Date: Sun, 18 May 2025 21:31:03 +1200 Subject: [PATCH] Update wifi.py --- src/wifi.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/wifi.py b/src/wifi.py index 32a9036..5839234 100644 --- a/src/wifi.py +++ b/src/wifi.py @@ -1,8 +1,5 @@ import network -from machine import Pin from time import sleep -import ubinascii -from settings import Settings def connect(ssid, password, ip, gateway): if ssid is None or password is None: @@ -26,21 +23,16 @@ def connect(ssid, password, ip, gateway): return None -def ap(password): +def ap(ssid, password): ap_if = network.WLAN(network.AP_IF) ap_mac = ap_if.config('mac') - ssid = f"led-{ubinascii.hexlify(ap_mac).decode()}" print(ssid) ap_if.active(True) - ap_if.config(essid=ssid, password="qwerty1234") + ap_if.config(essid=ssid, password=password) ap_if.active(False) ap_if.active(True) print(ap_if.ifconfig()) - - - - - - - +def get_mac(): + ap_if = network.WLAN(network.AP_IF) + return ap_if.config('mac')