fix: maixcam wifi连接

This commit is contained in:
2026-06-25 11:02:19 +08:00
parent aee1a92760
commit 6d8de56bfa
+12 -12
View File
@@ -624,16 +624,16 @@ class NetworkManager:
password = inner_data.get("password") password = inner_data.get("password")
ota_res_url = inner_data.get("url") ota_res_url = inner_data.get("url")
try: try:
ip, err = self.connect_wifi(ssid, password, persist=False, timeout_s=15, verify_host=None, verify_port=None) w = network.wifi.Wifi()
if err: e = w.connect(ssid, password, wait=True, timeout=15)
raise RuntimeError(err) err.check_raise(e, "connect wifi failed")
if self.logger: if self.logger:
self.logger.info(f"[ota] Connect success, got ip{ip}") self.logger.info(f"[ota] Connect success, got ip{w.get_ip()}")
self.safe_enqueue( self.safe_enqueue(
{ {
"cmd": 300, "cmd": 300,
"result": "ota start...", "result": "ota start...",
"wifi": ip, "wifi": w.get_ip(),
}, },
2, 2,
) )
@@ -643,7 +643,7 @@ class NetworkManager:
{ {
"cmd": 300, "cmd": 300,
"result": "success", "result": "success",
"wifi": ip, "wifi": w.get_ip(),
}, },
2, 2,
) )
@@ -665,16 +665,16 @@ class NetworkManager:
ssid = inner_data.get("ssid") ssid = inner_data.get("ssid")
password = inner_data.get("password") password = inner_data.get("password")
try: try:
ip, err = self.connect_wifi(ssid, password, persist=False, timeout_s=15, verify_host=None, verify_port=None) w = network.wifi.Wifi()
if err: e = w.connect(ssid, password, wait=True, timeout=15)
raise RuntimeError(err) err.check_raise(e, "connect wifi failed")
if self.logger: if self.logger:
self.logger.info(f"[conn wifi] Connect success, got ip{ip}") self.logger.info(f"[ota] Connect success, got ip{w.get_ip()}")
self.safe_enqueue( self.safe_enqueue(
{ {
"cmd": 600, "cmd": 600,
"result": "success", "result": "success",
"wifi": ip, "wifi": w.get_ip(),
}, },
2, 2,
) )
@@ -2148,7 +2148,7 @@ class NetworkManager:
self.logger.info(f"password: {password}") self.logger.info(f"password: {password}")
ota_manager._start_update_thread() ota_manager._start_update_thread()
self._spawn_cmd_thread(ota_manager.handle_wifi_and_update, self._spawn_cmd_thread(ota_manager.handle_wifi_and_update,
(ssid, password, ota_url)) (ssid, password, ota_url))
elif inner_cmd == 6: elif inner_cmd == 6:
try: try:
ip = os.popen( ip = os.popen(