|
|
@@ -90,6 +90,10 @@ int __io_putchar(int ch)
|
|
|
}
|
|
|
|
|
|
void Device_Info_Init_Fun() {
|
|
|
+ //初始化环形缓冲区
|
|
|
+ RingBuffer_Init(&deviceInfo.queueBLData);
|
|
|
+ RingBuffer_Init(&deviceInfo.queueLoraCommandData);
|
|
|
+
|
|
|
deviceInfo.isOnline = FALSE;
|
|
|
deviceInfo.isSOS = FALSE;
|
|
|
deviceInfo.broadcast_type = BROADCAST_ALL;
|
|
|
@@ -268,8 +272,6 @@ int main(void)
|
|
|
|
|
|
powerOn();
|
|
|
E52_CtlPowerOn_Fun();
|
|
|
- //初始化环形缓冲区
|
|
|
- RingBuffer_Init(&deviceInfo.queueBLData);
|
|
|
Device_Info_Init_Fun();
|
|
|
// 启动 USART2 DMA 接收
|
|
|
HAL_UART_Receive_DMA(&huart3, rx_buf, sizeof(rx_buf));
|
|
|
@@ -337,6 +339,8 @@ int main(void)
|
|
|
|
|
|
// 检查是否接收到"心跳"命令,且设备在线
|
|
|
printf("设备状态:0x%02X\n", deviceInfo.commandFromCloud);
|
|
|
+
|
|
|
+ schedule_Fun();
|
|
|
// 心跳:不在线时,每 10 秒发一次
|
|
|
if (!deviceInfo.isOnline) {
|
|
|
if (IsTimeElapsed(&hrtc, &Online_struct, 10)) {
|