diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/iot_mqtt_srv.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/iot_mqtt_srv.c index dabf066..3836733 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/iot_mqtt_srv.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/iot_mqtt_srv.c @@ -776,10 +776,6 @@ void iot_mqtt_publish_sensor(void) { } } - /* 快照落盘: 主循环上下文 (Step1 直读帧 + 回调帧都已在 ingest 入队); - 放在 READY/enable 检查之前 → 断网/未使能期间照常落 (脱机取证语义) */ - snap_flush(); - /*--- 事件上报状态机: 发送/重发/重连补报 ---*/ iot_evt_process(); diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c index 3be6451..2a8135c 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/peripheral_main.c @@ -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 兼容) */