debug hotspot
This commit is contained in:
parent
1aa4079807
commit
601196b923
|
@ -22,8 +22,7 @@ def close_app():
|
|||
if led_enabled:
|
||||
orangepi.set_led_off('red')
|
||||
|
||||
# 关闭热点
|
||||
close_hotspot()
|
||||
|
||||
|
||||
# 获取当前Flask应用程序的进程ID
|
||||
flask_pid = os.getpid()
|
||||
|
@ -227,17 +226,19 @@ def submit():
|
|||
ssid = request.form['ssid']
|
||||
password = request.form['password']
|
||||
print(f"{datetime.datetime.now()}: Connecting to Wi-Fi: {ssid} with password {password}")
|
||||
connected = connect_wifi(ssid, password)
|
||||
|
||||
# 关闭热点
|
||||
close_hotspot()
|
||||
|
||||
time.sleep(5)
|
||||
# 检查是否成功连接Wi-Fi
|
||||
if check_wifi_connection() and connected:
|
||||
# connected successfully, close flask
|
||||
# 连接到用户选择的 Wi-Fi 网络
|
||||
if connect_wifi(ssid, password):
|
||||
close_app()
|
||||
|
||||
else:
|
||||
if not check_wifi_connection():
|
||||
print(f"{datetime.datetime.now()}: Wi-Fi连接失败。")
|
||||
restart_hotspot()
|
||||
wifi_list = scan_wifi()
|
||||
start_hotspot()
|
||||
|
||||
return redirect(url_for('index'))
|
||||
|
||||
|
|
Loading…
Reference in New Issue