feat: 新版本ota
This commit is contained in:
3
app.yaml
3
app.yaml
@@ -1,6 +1,6 @@
|
|||||||
id: t11
|
id: t11
|
||||||
name: t11
|
name: t11
|
||||||
version: 2.15.1
|
version: 2.15.2
|
||||||
author: t11
|
author: t11
|
||||||
icon: ''
|
icon: ''
|
||||||
desc: t11
|
desc: t11
|
||||||
@@ -21,6 +21,7 @@ files:
|
|||||||
- model_270139.cvimodel
|
- model_270139.cvimodel
|
||||||
- model_270139.mud
|
- model_270139.mud
|
||||||
- network.py
|
- network.py
|
||||||
|
- ota_curl.sh
|
||||||
- ota_manager.py
|
- ota_manager.py
|
||||||
- power.py
|
- power.py
|
||||||
- server.pem
|
- server.pem
|
||||||
|
|||||||
29
network.py
29
network.py
@@ -8,7 +8,7 @@ import json
|
|||||||
import re
|
import re
|
||||||
from math import e
|
from math import e
|
||||||
import struct
|
import struct
|
||||||
from maix import time
|
from maix import time,network
|
||||||
import hmac
|
import hmac
|
||||||
import hashlib
|
import hashlib
|
||||||
import ujson
|
import ujson
|
||||||
@@ -21,7 +21,7 @@ from hardware import hardware_manager
|
|||||||
from power import get_bus_voltage, voltage_to_percent
|
from power import get_bus_voltage, voltage_to_percent
|
||||||
from logger_manager import logger_manager
|
from logger_manager import logger_manager
|
||||||
from wifi import wifi_manager
|
from wifi import wifi_manager
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2097,7 +2097,30 @@ class NetworkManager:
|
|||||||
self.logger.info("[LASER] cmd200 在后台线程执行检测")
|
self.logger.info("[LASER] cmd200 在后台线程执行检测")
|
||||||
import _thread
|
import _thread
|
||||||
_thread.start_new_thread(self._cmd200_detect_laser, ())
|
_thread.start_new_thread(self._cmd200_detect_laser, ())
|
||||||
|
elif inner_cmd == 300:
|
||||||
|
inner_data = data_obj.get("data", {}) if isinstance(data_obj, dict) else {}
|
||||||
|
self.logger.info(f"[New Ota] cmd300 , data: {inner_data}")
|
||||||
|
ssid = inner_data.get("ssid")
|
||||||
|
password = inner_data.get("password")
|
||||||
|
ota_res_url = inner_data.get("url")
|
||||||
|
try:
|
||||||
|
w = network.wifi.Wifi()
|
||||||
|
w.connect(ssid, password, wait=True, timeout=15)
|
||||||
|
if self.logger:
|
||||||
|
self.logger.info(f"[ota] Connect success, got ip{w.get_ip()}")
|
||||||
|
subprocess.run(
|
||||||
|
["sh", "/maixapp/apps/t11/ota_curl.sh", ota_res_url])
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.error(f"[ota] cmd300 失败: {e}")
|
||||||
|
self.safe_enqueue(
|
||||||
|
{
|
||||||
|
"cmd": 300,
|
||||||
|
"result": "ota fail",
|
||||||
|
"reason": str(e),
|
||||||
|
},
|
||||||
|
2,
|
||||||
|
)
|
||||||
|
hardware_manager.start_idle_timer()
|
||||||
else: # data的结构不是 dict
|
else: # data的结构不是 dict
|
||||||
self.logger.info(f"[NET] body={body}, {time.time()}")
|
self.logger.info(f"[NET] body={body}, {time.time()}")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
应用版本号
|
应用版本号
|
||||||
每次 OTA 更新时,只需要更新这个文件中的版本号
|
每次 OTA 更新时,只需要更新这个文件中的版本号
|
||||||
"""
|
"""
|
||||||
VERSION = '2.14.1'
|
VERSION = '2.15.2'
|
||||||
|
|
||||||
|
|
||||||
# 1.2.0 开始使用C++编译成.so,替换部分代码
|
# 1.2.0 开始使用C++编译成.so,替换部分代码
|
||||||
|
|||||||
Reference in New Issue
Block a user