feat(ota): 解耦ESP32 OTA核心逻辑到独立模块并增强BLE控制功能
- 新增ota目录和esp32_ota_core.cpp实现ESP32 OTA核心功能,支持begin/write/finalize操作 - 修改CMakeLists.txt添加ota源文件和包含目录 - 重构ble_ota.cpp将OTA写入/收尾逻辑委托给Esp32OtaCore,移除mbedtls直接引用 - 新增BLE_OTA_CTRL_RESTART_ESP32(0xFA)命令用于重启ESP32设备 - 更新BLE_OTA_CTRL_TRIGGER_ESP32(0xF8)逻辑,要求前端提供SHA-256校验并比对 - 添加SHA-256校验不匹配错误码BLE_OTA_FINISH_ERR_SHA_MISMATCH(0x85) - 优化OTA收尾流程,设备端读取分区计算SHA-256并与前端提供的哈希比对 - 添加BLE_OTA_NOTIFY_SHA256通知类型用于上报设备端计算的SHA-256值 - 更新app_config.h中的BLE OTA命令描述文档 - 移除BleOta类中的OTA状态变量,仅保留BLE传输层相关状态 - 更新版本构建时间和Git哈希信息
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import os
|
||||
os.chdir(r'G:\Robot_v2\DCU\ESP32_COMM')
|
||||
with open('tools/ble_ota.html', 'r', encoding='utf-8-sig') as f:
|
||||
text = f.read()
|
||||
|
||||
# Try a small, single line replace
|
||||
old = " fileSha256: null,"
|
||||
print('old line found:', text.count(old))
|
||||
|
||||
# Now do a multi-line block test
|
||||
old_block = """ fileSha256: null,
|
||||
deviceSha256: null,
|
||||
expectedReboot: false, // 发送 0xFA 后置 true,重连后清
|
||||
reconnecting: false, // 自动重连中
|
||||
reconnectAttempts: 0, // 重连尝试次数
|
||||
shaWaiter: null, // {resolve, reject, timer} 0xC1 等待者
|
||||
};"""
|
||||
|
||||
print('block found:', old_block in text)
|
||||
print('block repr (last 200):', repr(old_block[-200:]))
|
||||
Reference in New Issue
Block a user