V1.5: 修复4G OTA失败假死(OTA入口复位模组致MQTT断连但标志未清),失败路径退出后标记RSN_OTA_FAIL并主动复位

This commit is contained in:
helei 2026-08-18 15:47:58 +08:00
parent 9d1842404c
commit 71fd432f87
4 changed files with 11 additions and 1 deletions

View File

@ -562,7 +562,12 @@ void air780e_trigger_ota(const char *host, int port, const char *path, const cha
g_net_tx_busy = 1; /* 屏蔽业务侧 NET_publish_*, 防止与 AT 应答交织 */
air780e_trigger_ota_body(host, port, path, ota_id, new_ver, crc16);
g_net_tx_busy = 0;
log_warn("> OTA: 已中止,恢复正常运行");
/* body 任何失败路径返回后必须复位OTA 入口已复位过 4G 模组,
* MQTT ready 1"假在线" OTA */
log_warn("> OTA: 失败中止,复位恢复联网");
reset_log_mark(RSN_OTA_FAIL);
HAL_Delay(100);
NVIC_SystemReset();
}
static void air780e_trigger_ota_body(const char *host, int port, const char *path, const char *ota_id, uint16_t new_ver, uint16_t crc16) {

View File

@ -56,6 +56,7 @@ static const char *reason_str(uint8_t r)
case RSN_CMD_RECOVERY: return "串口RECOVERY命令";
case RSN_POWER_LOSS: return "外部断电(法拉电容记录)";
case RSN_4G_MODULE: return "4G模组异常自重启";
case RSN_OTA_FAIL: return "OTA失败中止";
case RSN_SOFT_GENERIC: return "软件复位(未标记)";
default: return "未知";
}

View File

@ -38,6 +38,7 @@ typedef struct {
#define RSN_POWER_LOSS 14 /* 外部 12V 断电(法拉电容续航中记录) */
#define RSN_4G_MODULE 15 /* 4G 模组异常自重启(boot.rom) */
#define RSN_SOFT_GENERIC 16 /* 软件复位(未标记细分原因,如 JLink 复位) */
#define RSN_OTA_FAIL 17 /* OTA 下载/前置检查失败,中止后复位 */
static inline uint32_t boot_share_sum(const volatile boot_share_t *s)
{

View File

@ -142,3 +142,6 @@
开机 pow/ICCID 上报间隔拉开到 300ms
- 断电上报再提速PA0 检测从 1s 轮询改 50ms 快轮询(检测+确认 ~150ms 触发);先发包后打日志;
修复发送通道忙时掉电消息被丢弃不重试的问题NET_publish_power 返回状态,忙则 50ms 后重试直到发出)
- 修复 4G OTA 失败后"假死"(平台不可控/无法再 OTAOTA 入口会复位 4G 模组MQTT 已断但
ready 标志未清S1~S4 等前置失败退出后设备假在线。现改为任何 OTA 失败路径退出后
标记原因(RSN_OTA_FAIL "OTA失败中止")并主动复位,重启走干净 4G 初始化恢复联网