Ver código fonte

调试初步完成。删除loraSendSuccessFlag。因为配置后出现不复位的情况。(烧录版本:描述 完成4个命令)

xuxinyi 1 mês atrás
pai
commit
1ee566f4bf
5 arquivos alterados com 20 adições e 13 exclusões
  1. 1 1
      Core/Inc/E52.h
  2. 3 3
      Core/Src/E52.c
  3. 4 7
      Core/Src/main.c
  4. 1 1
      Core/Src/stm32f1xx_it.c
  5. 11 1
      README.md

+ 1 - 1
Core/Inc/E52.h

@@ -116,7 +116,7 @@ typedef struct {
     uint8_t commandFromCloud; //从云端接收到的命令     1.请求蓝牙数据,2.请求lora数据,3.睡眠 4,重新发送点卯数据
 
     //lora发生成功标志
-    uint8_t loraSendSuccessFlag;
+    // uint8_t loraSendSuccessFlag;
 
     //定时器相关
     // uint8_t  timerEnable;           //定时器使能

+ 3 - 3
Core/Src/E52.c

@@ -93,7 +93,7 @@ void E52_Send_Bl_Data_Fun( uint8_t *sendData,  uint8_t finishData) {
     // printf("blData size = %d\n", sizeof(sendBlData_structure));
 
 
-    deviceInfo.loraSendSuccessFlag = 1;
+    // deviceInfo.loraSendSuccessFlag = 1;
     HAL_UART_Transmit(&huart2, (uint8_t *)&sendBlData_structure, sizeof(sendBlData_structure), HAL_MAX_DELAY);
     // TODO: command:02
 }
@@ -146,8 +146,8 @@ void E52_Request_Command_Fun() {
 void E52_Configuration_Fun() {
     printf("这是配置lora发送方式的命令\r\n");
 
-    deviceInfo.target_addr_H = rx_buf_uart2[6];
-    deviceInfo.target_addr_L = rx_buf_uart2[7];
+    deviceInfo.target_addr_H = rx_buf_uart2[8];
+    deviceInfo.target_addr_L = rx_buf_uart2[9];
     switch (rx_buf_uart2[5]) {
         case BROADCAST_ALL:
             deviceInfo.broadcast_type = BROADCAST_ALL;

+ 4 - 7
Core/Src/main.c

@@ -104,7 +104,7 @@ void Device_Info_Init_Fun() {
   deviceInfo.BlDataFlag = BL_IDLE;
   // deviceInfo.newLoraDataFlag = 0;
   // deviceInfo.isReady = 0;
-  deviceInfo.loraSendSuccessFlag = 0;
+  // deviceInfo.loraSendSuccessFlag = 0;
   deviceInfo.BlDataFlag = BL_START;
   deviceInfo.commandFromCloud = COMBINE_CMD_STEP(IDLE, STEP_INIT);  //初始化
   //TODO: 大循环,获取设备地址信息,否则重新发送。发送上线信息,等待反馈,否则重新发送上线信息。一切准备就绪后,开启isready为1,进入工作模式。
@@ -372,7 +372,7 @@ int main(void)
 
         case REQUEST_BLUETOOTH_DATA_SEND:
           uint8_t sentData_Temp[25] = {0};
-          if (deviceInfo.loraSendSuccessFlag == 0) {   //   5   5
+          if (TRUE) {   //   5   5
             if (RingBuffer_Dequeue(&deviceInfo.queueBLData, sentData_Temp) == 0 && deviceInfo.forwardBLAndLoraDataCount < deviceInfo.forwardBLAndLoraDataCountMax) {
               //不为空的情况下
               E52_Send_Bl_Data_Fun(sentData_Temp,0x00);
@@ -409,7 +409,7 @@ int main(void)
     if (GET_CMD( deviceInfo.commandFromCloud)  == E52_HEARTBEAT && deviceInfo.isOnline) {
       switch (GET_STEP(deviceInfo.commandFromCloud)) {
         case HEARTBEAT_SEND:
-          if (deviceInfo.loraSendSuccessFlag == 0) {
+          if (TRUE) {
             E52_Heartbeat_Fun();
             deviceInfo.commandFromCloud = COMBINE_CMD_STEP(REQUEST_BLUETOOTH_DATA, STEP_COMPLETE);
           }
@@ -445,11 +445,8 @@ int main(void)
           break;        //如果是单波,多播,配置目标地址
 
           case STEP_COMPLETE:
-            if (deviceInfo.loraSendSuccessFlag == 0) {
+            if (TRUE) {
               E52_Heartbeat_Fun();
-
-            }else {
-              continue;
             }
             deviceInfo.commandFromCloud = COMBINE_CMD_STEP(IDLE, STEP_INIT);
           break;

+ 1 - 1
Core/Src/stm32f1xx_it.c

@@ -305,7 +305,7 @@ void USART2_IRQHandler(void)
       // ====== 判断 "SUCCESS" ======
       else if (rx_len >= 7 && strncmp((char *)rx_buf_uart2_DMA, "SUCCESS", 7) == 0)
       {
-        deviceInfo.loraSendSuccessFlag = 0;
+        // deviceInfo.loraSendSuccessFlag = 0;
       }
       // ====== 判断 "AT" 指令 ======
       else if (rx_len >= 2 && strncmp((char *)rx_buf_uart2_DMA, "AT", 2) == 0)

+ 11 - 1
README.md

@@ -57,7 +57,17 @@
     }
 
 4.配置lora
-55 BB 07 FC A5 03 34 60 FF EE :配置lora
+55 BB 07 BA 8F 01 00 00 34 60 FF EE
+
+    {
+        55 BB       : 帧头
+        07          : 命令(配置lora)
+        BA 8F       : 设备地址
+        01          : 广播形式 01单波  02多播  03广播
+        00 00       : 保留
+        34 60       : 目标地址
+        FF EE       : 帧尾
+    }
 
 5.中继休眠