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