Remove WiFi station (client) support
- Drop station connect/status/credentials from wifi util and settings API - Remove station activation from main - Remove station UI and JS from index, settings template, and help.js - Device settings now only configure WiFi Access Point Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,28 +1,4 @@
|
||||
import network
|
||||
from time import sleep
|
||||
|
||||
def connect(ssid, password, ip, gateway):
|
||||
if ssid is None:
|
||||
print("Missing ssid")
|
||||
return None
|
||||
if password is None:
|
||||
password = ''
|
||||
try:
|
||||
sta_if = network.WLAN(network.STA_IF)
|
||||
if ip is not None and gateway is not None:
|
||||
sta_if.ifconfig((ip, '255.255.255.0', gateway, '1.1.1.1'))
|
||||
if not sta_if.isconnected():
|
||||
print('connecting to network...')
|
||||
sta_if.active(True)
|
||||
sta_if.connect(ssid, password)
|
||||
sleep(0.1)
|
||||
if sta_if.isconnected():
|
||||
return sta_if.ifconfig()
|
||||
return None
|
||||
return sta_if.ifconfig()
|
||||
except Exception as e:
|
||||
print(f"Failed to connect to wifi {e}")
|
||||
return None
|
||||
|
||||
|
||||
def ap(ssid, password, channel=None):
|
||||
@@ -42,6 +18,7 @@ def get_mac():
|
||||
ap_if = network.WLAN(network.AP_IF)
|
||||
return ap_if.config('mac')
|
||||
|
||||
|
||||
def get_ap_config():
|
||||
"""Get current AP configuration."""
|
||||
try:
|
||||
@@ -63,38 +40,3 @@ def get_ap_config():
|
||||
except Exception as e:
|
||||
print(f"Error getting AP config: {e}")
|
||||
return None
|
||||
|
||||
def get_sta_status():
|
||||
"""Get current station connection status."""
|
||||
try:
|
||||
sta_if = network.WLAN(network.STA_IF)
|
||||
if sta_if.active():
|
||||
if sta_if.isconnected():
|
||||
config = sta_if.ifconfig()
|
||||
return {
|
||||
'connected': True,
|
||||
'ssid': sta_if.config('essid'),
|
||||
'ip': config[0] if config else None,
|
||||
'gateway': config[2] if len(config) > 2 else None,
|
||||
'netmask': config[1] if len(config) > 1 else None,
|
||||
'dns': config[3] if len(config) > 3 else None
|
||||
}
|
||||
return {
|
||||
'connected': False,
|
||||
'ssid': None,
|
||||
'ip': None,
|
||||
'gateway': None,
|
||||
'netmask': None,
|
||||
'dns': None
|
||||
}
|
||||
return {
|
||||
'connected': False,
|
||||
'ssid': None,
|
||||
'ip': None,
|
||||
'gateway': None,
|
||||
'netmask': None,
|
||||
'dns': None
|
||||
}
|
||||
except Exception as e:
|
||||
print(f"Error getting STA status: {e}")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user