fix(vd960DBN): 启动诊断打印 + snap_flush 无条件挂载
现场: 懒擦后仍起不来 (200ms 乱码后死机), 需定位复位/卡死点 - main 开头打印 RST_REASON (RCC_RSTSCKR): 一锤定音区分 IWDG死锁(bit31) / POR掉电(bit25) / NRST外部复位(bit26) / 软复位(bit24) - 各 init 步骤加标记 (storage/offlog/snap ok), 定位卡死位置 - snap_flush 从 iot_enable 分支移到 Main_Circulation 无条件调用: 原实现 TCP 模式(iot_enable=0)下快照永不落盘, RAM 暂存满丢新
This commit is contained in:
@@ -776,10 +776,6 @@ void iot_mqtt_publish_sensor(void) {
|
||||
}
|
||||
}
|
||||
|
||||
/* 快照落盘: 主循环上下文 (Step1 直读帧 + 回调帧都已在 ingest 入队);
|
||||
放在 READY/enable 检查之前 → 断网/未使能期间照常落 (脱机取证语义) */
|
||||
snap_flush();
|
||||
|
||||
/*--- 事件上报状态机: 发送/重发/重连补报 ---*/
|
||||
iot_evt_process();
|
||||
|
||||
|
||||
@@ -268,6 +268,7 @@ void Main_Circulation(void)
|
||||
}
|
||||
|
||||
uart_srv();
|
||||
snap_flush(); /* 快照落盘: 无条件挂主循环 (原在 iot_enable 分支, TCP 模式不落盘) */
|
||||
|
||||
poll_dbn_ble();
|
||||
|
||||
@@ -300,12 +301,18 @@ int main(void)
|
||||
// USART_Printf_Init( 115200 );
|
||||
USART_Printf_Init( 256000 );
|
||||
#endif
|
||||
/* 诊断: 复位原因寄存器 (bit31=IWDG bit30=WWDG bit29=LPWR bit26=NRST bit25=POR bit24=软复位)
|
||||
每次上电必打, 区分看门狗死锁 vs 掉电 vs 外部复位 */
|
||||
PRINT("RST_REASON: 0x%08lx\n", (unsigned long)OFFLOG_RCC_RSTSCKR);
|
||||
PRINT("%s\n", VER_LIB);
|
||||
PRINT("SystemCoreClock:%d\n", SystemCoreClock);
|
||||
GetMacAddr(gMacAddr);
|
||||
storage_init();
|
||||
PRINT("INIT: storage ok\n");
|
||||
offlog_init();
|
||||
PRINT("INIT: offlog ok\n");
|
||||
snap_init();
|
||||
PRINT("INIT: snap ok\n");
|
||||
|
||||
/* 复位原因: 必须在初始化后立即读 (离复位时刻最近), 并清除标志,
|
||||
保证下次上电只反映本次复位原因 (RCC_RSTSCKR, STM32F1/CH32V20x 兼容) */
|
||||
|
||||
Reference in New Issue
Block a user