ソースを参照

2024.1.19修复按键导致不进入休眠

wanghechen 9 ヶ月 前
コミット
492150c25a

+ 16 - 1
components/LORA/LORA.c

@@ -754,7 +754,8 @@ void reset_lora(uint8_t new_channel)
     //     printf("\n\n");
     // }
 
-    lora_set_config_mode(0x00);
+    // lora_set_config_mode(0x00);
+    lora_reset();
     vTaskDelay(100 / portTICK_PERIOD_MS);
 
     user_size = y_ringbuf_get_used_size(lora_ringbuf);
@@ -1841,6 +1842,20 @@ void lora_set_config_mode(uint8_t mode)
 
 #endif
 }
+void lora_reset(void)
+{
+  // printf("%s\r\n",__FUNCTION__);
+#if 1
+  uint8_t lorabuf[4];
+  lorabuf[0] = 0x03;
+  lorabuf[1] = 0x22;
+  lorabuf[2] = 0x01;
+  lorabuf[3] = crc8(lorabuf, 3, 0x55, 0x07);
+
+  lora_sendData(lorabuf, sizeof(lorabuf));
+
+#endif
+}
 
 void lora_set_into_config_mode()
 {

+ 1 - 1
components/LORA/include/LORA.h

@@ -249,7 +249,7 @@ uint8_t crc8( uint8_t *pData,
                     uint16_t dataLen,
                     uint8_t initialValue, 
                     uint8_t polynomial );
-
+void lora_reset(void);
 #if 0
 bool lora_uart_is_normal(int Baud);
 

+ 1 - 1
components/button/include/user_button.h

@@ -136,7 +136,7 @@ void power_button_init(adc_oneshot_unit_handle_t adc_handle);
 void power_button_deinit(void);
 
 int  find_key_value(int value);
-
+void change_is_down(void);
 bool is_btn_timeout(void);
 void send_button_key_queue(uint8_t value);
 void reset_btn_last_time(void);

+ 9 - 0
components/button/user_button.c

@@ -391,6 +391,10 @@ bool is_key_press(void)
 {
     return is_down;
 }
+void change_is_down(void)
+{
+    is_down = false;
+}
 static void power_long_press_hold_cb(void *arg, void *usr_data)
 {
     // 设置的长按开始时间后开始计算hold_cnt  长按开始时间设置为1s,cnt计算时间间隔(SERIAL_TICKS)也设置为1s
@@ -438,6 +442,11 @@ static void power_long_press_hold_cb(void *arg, void *usr_data)
         }
         break;
     case 4: // 5s开关机
+        if (is_setting || is_reset_net)
+        {
+            ESP_LOGE(LOG_TAG, "5s poweron return ");
+            break;
+        }
         button_info = POWER_ON_INTO_STATUS_CHANGE_VALUE;
         if (xQueueSend(button_Data_queue, &button_info, 0) != true)
         {

+ 1 - 1
components/c_linked_list/list.h

@@ -21,7 +21,7 @@ typedef enum {
 typedef struct queue
 {
 	bool flag;
-	uint8_t num;
+	uint32_t num;
 }LORA_POOL_t;
 extern RTC_FAST_ATTR LORA_POOL_t lora_pool[LORA_INFO_END];
 

+ 2 - 0
main/esp_ble_ota.c

@@ -297,6 +297,8 @@ void ota_task(void *arg)
 
 OTA_ERROR:
     ESP_LOGE(TAG, "OTA failed");
+    extern void change_is_down(void);
+    change_is_down();
     esp_ble_ota_delete();
     vTaskDelete(NULL);
 #include "iot_button.h"

+ 151 - 133
main/yc_protocol.c

@@ -214,7 +214,7 @@ void update_last_button_info(uint8_t btn)
 void screen_display(void)
 {
 
-    font_exit_sleep();
+    // font_exit_sleep();
 
     EventBits_t bits = xEventGroupWaitBits(screen_event,
                                            LEFT_SCREEN_BIT | RIGHT_SCREEN_BIT,
@@ -1327,15 +1327,12 @@ static void hardware_gwpair_func(const LORA_DATA_T *buf)
 
     Machine_info.paired = 1; // 已配对
 
-#if 0
-    send_pair_ack();
-#else
+
     int msg_id = (buf->data_buf[11] << 8) | buf->data_buf[12]; // 获取当前消息id 用于删除
     printf("msg_id =%X\r\n", msg_id);
 
     reply_ack_func(PROTOCOL_HARDWARE_GWPAIRED, msg_id, true, NULL); // 回复ack
 
-#endif
     // vTaskDelay(200 / portTICK_PERIOD_MS);
     // //修改信道前修改设备ID 及 设备ID
     //  dymatic_change_device_id(child_num+1);
@@ -1346,7 +1343,7 @@ static void hardware_gwpair_func(const LORA_DATA_T *buf)
 
     vTaskDelay(200 / portTICK_PERIOD_MS);
     Machine_info.rssi = set_lora(Machine_info.lora_new_channel, Machine_info.eflagID);
-    f_send_get_time();
+    // f_send_get_time();
     f_send_version();
     f_send_reply_status(0x01); // 回复在线状态
     f_send_update_status();
@@ -1437,15 +1434,12 @@ static void hardware_ungwpair_func(const LORA_DATA_T *buf)
 
     // 取消配网成功 回复 ACK 设置新的信道
 
-#if 0
-    send_pair_ack();
-#else
+
     int msg_id = (buf->data_buf[11] << 8) | buf->data_buf[12]; // 获取当前消息id 用于删除
     // printf("msg_id =%X\r\n",msg_id);
 
     reply_ack_func(PROTOCOL_HARDWARE_UNGWPAIRED, msg_id, true, NULL); // 回复ack
 
-#endif
 
     // #include "user_sleep.h"
     // #include "esp_sleep.h"
@@ -1465,6 +1459,7 @@ static void hardware_ungwpair_func(const LORA_DATA_T *buf)
     Machine_info.lora_new_channel = LORA_CHANENL;
     // dymatic_change_chanel(Machine_info.lora_factory_channel);  //切换信道
     reset_lora(LORA_CHANENL);
+    Machine_info.paired = 0; // 解除配对
 }
 /*网关收到终端发送的数据 ACK 终端收到用于删除当前的msgid的数据*/
 static void hardware_ack_delete_msg_id(const LORA_DATA_T *buf)
@@ -2244,7 +2239,6 @@ void f_send_get_time(void)
     uint8_t strlorabuf[200];
     uint8_t strnum[20];
 
-    static int rssiold = 0;
     int crc16 = 0, i = 0, len = 0;
 
     strlorabuf[0] = 0x5A;
@@ -2261,7 +2255,11 @@ void f_send_get_time(void)
     strlorabuf[10] = 0x01;                // cmd命令字
 
     Machine_info.msg_id = allocateMsgIdNum(); // 分配ID
-
+    if (Machine_info.msg_id > 1000)
+    {
+        ESP_LOGE(LOG_TAG, "time Machine_info.msg_id>1000");
+        return;
+    }
     strlorabuf[11] = ((Machine_info.msg_id) >> 8) & 0XFF; //
     strlorabuf[12] = ((Machine_info.msg_id) >> 0) & 0XFF; // 总包数,当前包数
 
@@ -2308,7 +2306,12 @@ void f_send_get_chart_data(void)
     strlorabuf[9] = Machine_info.eflagID; // 组内编号
     strlorabuf[10] = 0x11;                // cmd命令字
 
-    Machine_info.msg_id = allocateMsgIdNum();             // 分配ID
+    Machine_info.msg_id = allocateMsgIdNum(); // 分配ID
+    if (Machine_info.msg_id > 1000)
+    {
+        ESP_LOGE(LOG_TAG, "chart Machine_info.msg_id>1000");
+        return;
+    }
     strlorabuf[11] = ((Machine_info.msg_id) >> 8) & 0XFF; //
     strlorabuf[12] = ((Machine_info.msg_id) >> 0) & 0XFF; // 总包数,当前包数
 
@@ -2329,7 +2332,7 @@ void f_send_get_chart_data(void)
     // lora_send_data((char *)strlorabuf,len);
     lora_pool[LORA_INFO_GET_CHART].num = Machine_info.msg_id;
     lora_pool[LORA_INFO_GET_CHART].flag = true;
-    Send_list = postInsert(Send_list, Machine_info.msg_id, LORA_INFO_GET_CHART, (char *)strlorabuf, len); // 插入数据
+    Send_list = postInsert(Send_list, (int)Machine_info.msg_id, LORA_INFO_GET_CHART, (char *)strlorabuf, len); // 插入数据
 }
 void f_send_version(void)
 {
@@ -2338,7 +2341,7 @@ void f_send_version(void)
         ESP_LOGE(LOG_TAG, "%s-->return", __FUNCTION__);
         return;
     }
-    ESP_LOGW(LOG_TAG, "f_send_version");
+    // ESP_LOGW(LOG_TAG, "f_send_version");
     uint8_t strlorabuf[200];
 
     int crc16 = 0, i = 0, len = 0;
@@ -2356,7 +2359,12 @@ void f_send_version(void)
     strlorabuf[9] = Machine_info.eflagID; // 组内编号
     strlorabuf[10] = 0x91;                // cmd命令字
 
-    Machine_info.msg_id = allocateMsgIdNum();             // 分配ID
+    Machine_info.msg_id = allocateMsgIdNum(); // 分配ID
+    if (Machine_info.msg_id > 1000)
+    {
+        ESP_LOGE(LOG_TAG, "version Machine_info.msg_id>1000");
+        return;
+    }
     strlorabuf[11] = ((Machine_info.msg_id) >> 8) & 0XFF; //
     strlorabuf[12] = ((Machine_info.msg_id) >> 0) & 0XFF; // 总包数,当前包数
 
@@ -2379,7 +2387,7 @@ void f_send_version(void)
 
     lora_pool[LORA_INFO_VERSION].num = Machine_info.msg_id;
     lora_pool[LORA_INFO_VERSION].flag = true;
-    Send_list = postInsert(Send_list, Machine_info.msg_id, LORA_INFO_VERSION, (char *)strlorabuf, len); // 插入数据
+    Send_list = postInsert(Send_list, (int)Machine_info.msg_id, LORA_INFO_VERSION, (char *)strlorabuf, len); // 插入数据
 }
 void f_send_lora_rssi(int rssi)
 {
@@ -2406,7 +2414,12 @@ void f_send_lora_rssi(int rssi)
     strlorabuf[9] = Machine_info.eflagID; // 组内编号
     strlorabuf[10] = 0x05;                // cmd命令字
 
-    Machine_info.msg_id = allocateMsgIdNum();             // 分配ID
+    Machine_info.msg_id = allocateMsgIdNum(); // 分配ID
+    if (Machine_info.msg_id > 1000)
+    {
+        ESP_LOGE(LOG_TAG, "rssi Machine_info.msg_id>1000");
+        return;
+    }
     strlorabuf[11] = ((Machine_info.msg_id) >> 8) & 0XFF; //
     strlorabuf[12] = ((Machine_info.msg_id) >> 0) & 0XFF; // 总包数,当前包数
 
@@ -2427,7 +2440,7 @@ void f_send_lora_rssi(int rssi)
 
     lora_pool[LORA_INFO_RSSI].num = Machine_info.msg_id;
     lora_pool[LORA_INFO_RSSI].flag = true;
-    Send_list = postInsert(Send_list, Machine_info.msg_id, LORA_INFO_RSSI, (char *)strlorabuf, len); // 插入数据
+    Send_list = postInsert(Send_list, (int)Machine_info.msg_id, LORA_INFO_RSSI, (char *)strlorabuf, len); // 插入数据
 }
 void f_send_test(void)
 {
@@ -2472,7 +2485,7 @@ void f_send_test(void)
     len = strlen((char *)strlorabuf);
     // send_lora_data(strlorabuf, len);
     // lora_send_data((char *)strlorabuf, len);
-    Send_list = postInsert(Send_list, Machine_info.msg_id, LORA_INFO_BATT, (char *)strlorabuf, len); // 插入数据
+    Send_list = postInsert(Send_list, (int)Machine_info.msg_id, LORA_INFO_BATT, (char *)strlorabuf, len); // 插入数据
 }
 void f_send_battary_vaule(int battry)
 {
@@ -2498,7 +2511,12 @@ void f_send_battary_vaule(int battry)
     strlorabuf[9] = Machine_info.eflagID; // 组内编号
     strlorabuf[10] = 0x04;                // cmd命令字
 
-    Machine_info.msg_id = allocateMsgIdNum();             // 分配ID
+    Machine_info.msg_id = allocateMsgIdNum(); // 分配ID
+    if (Machine_info.msg_id > 1000)
+    {
+        ESP_LOGE(LOG_TAG, "batt Machine_info.msg_id>1000");
+        return;
+    }
     strlorabuf[11] = ((Machine_info.msg_id) >> 8) & 0XFF; //
     strlorabuf[12] = ((Machine_info.msg_id) >> 0) & 0XFF; // 总包数,当前包数
 
@@ -2519,7 +2537,7 @@ void f_send_battary_vaule(int battry)
 
     lora_pool[LORA_INFO_BATT].num = Machine_info.msg_id;
     lora_pool[LORA_INFO_BATT].flag = true;
-    Send_list = postInsert(Send_list, Machine_info.msg_id, LORA_INFO_BATT, (char *)strlorabuf, len); // 插入数据
+    Send_list = postInsert(Send_list, (int)Machine_info.msg_id, LORA_INFO_BATT, (char *)strlorabuf, len); // 插入数据
 }
 
 void f_send_reply_status(int status)
@@ -2567,7 +2585,7 @@ void f_send_reply_status(int status)
 
     lora_pool[LORA_INFO_REPLY].num = Machine_info.msg_id;
     lora_pool[LORA_INFO_REPLY].flag = true;
-    Send_list = postInsert(Send_list, Machine_info.msg_id, LORA_INFO_REPLY, (char *)strlorabuf, len); // 插入数据
+    Send_list = postInsert(Send_list,(int)Machine_info.msg_id, LORA_INFO_REPLY, (char *)strlorabuf, len); // 插入数据
 }
 
 // 唤醒时发送是否可以接收数据命令
@@ -3030,37 +3048,37 @@ void set_status_heights(void)
 //     // }
 // }
 
-void lora_timer_callback(void *arg)
-{
-    ESP_LOGI(LOG_TAG, " lora_timer_callback");
-
-    if (xQueueSend(yc_data_queue, &yc_data, 0) != true)
-    {
-        ESP_LOGE(LOG_TAG, "yc_data_queue send is fail");
-    }
-    yc_data.len = 0;
-    yc_data.index = 0;
-}
-void timer_init(void)
-{
-    // const esp_timer_create_args_t periodic_timer_args = {
-    //         .callback = &periodic_timer_callback,
-    //         /* name is optional, but may help identify the timer when debugging */
-    //         .name = "periodic"
-    // };
-
-    // ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
-    // /* The timer has been created but is not running yet */
-
-    // ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 1*1000*1000));
+// void lora_timer_callback(void *arg)
+// {
+//     ESP_LOGI(LOG_TAG, " lora_timer_callback");
 
-    // lora timer
-    const esp_timer_create_args_t lora_timer_args = {
-        .callback = &lora_timer_callback,
-        /* argument specified here will be passed to timer callback function */
-        .name = "one-shot"};
-    ESP_ERROR_CHECK(esp_timer_create(&lora_timer_args, &lora_timer));
-}
+//     if (xQueueSend(yc_data_queue, &yc_data, 0) != true)
+//     {
+//         ESP_LOGE(LOG_TAG, "yc_data_queue send is fail");
+//     }
+//     yc_data.len = 0;
+//     yc_data.index = 0;
+// }
+// void timer_init(void)
+// {
+//     // const esp_timer_create_args_t periodic_timer_args = {
+//     //         .callback = &periodic_timer_callback,
+//     //         /* name is optional, but may help identify the timer when debugging */
+//     //         .name = "periodic"
+//     // };
+
+//     // ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
+//     // /* The timer has been created but is not running yet */
+
+//     // ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 1*1000*1000));
+
+//     // lora timer
+//     const esp_timer_create_args_t lora_timer_args = {
+//         .callback = &lora_timer_callback,
+//         /* argument specified here will be passed to timer callback function */
+//         .name = "one-shot"};
+//     ESP_ERROR_CHECK(esp_timer_create(&lora_timer_args, &lora_timer));
+// }
 // void yc_timer_restart(void)
 // {
 //     ESP_LOGI(LOG_TAG,"timer restart");
@@ -3084,91 +3102,91 @@ void lora_timer_restart(void)
 
 #if 1
 
-/*********************************************************************************
- * function   :   analysis_protocol
- * Description :  lora 接受数据解析函数
- * Input       :
- * Output      :
- * Author      :  祁鑫                  Data : 2023 9.18
- **********************************************************************************/
-void analysis_protocol(char *result, int len)
-{
-    int index = 0;
-    int length = 0;
-
-    int count = len;
+// /*********************************************************************************
+//  * function   :   analysis_protocol
+//  * Description :  lora 接受数据解析函数
+//  * Input       :
+//  * Output      :
+//  * Author      :  祁鑫                  Data : 2023 9.18
+//  **********************************************************************************/
+// void analysis_protocol(char *result, int len)
+// {
+//     int index = 0;
+//     int length = 0;
 
-    int num = 0;
+//     int count = len;
 
-    while (count)
-    {
-
-        if (((result[index + 2]) == 0x5A) && ((result[index + 3]) == 0x51))
-        {
-            length = ((result[index]) << 8) | ((result[index + 1]));
-            num++;
-            printf("num =%d,length=%d\r\n", num, length);
+//     int num = 0;
 
-#if 1
-            for (int i = 0; i < length; i++)
-            {
-                printf("%02x", result[index + 2 + i]);
-            }
-#endif
-            printf("\r\n");
-
-            // 匹配mac地址    //计算校验和
-            if (
-                (Machine_info.mac_addr[0] == (result[index + 5])) &&
-                (Machine_info.mac_addr[1] == (result[index + 6])) &&
-                (Machine_info.mac_addr[2] == (result[index + 7])) &&
-                (Machine_info.mac_addr[3] == (result[index + 8])) &&
-                (Machine_info.mac_addr[4] == (result[index + 9])) &&
-                (Machine_info.mac_addr[5] == (result[index + 10])))
-            {
-
-                // mac地址匹配
-                printf("mac check ok\r\n");
-                // packetparsing((unsigned char *)&result[index+2]);  //16进制解析数据
-            }
-            else
-            {
-                printf("mac = %02x%02x%02x%02x%02x%02x\r\n",
-                       result[index + 5],
-                       result[index + 6],
-                       result[index + 7],
-                       result[index + 8],
-                       result[index + 9],
-                       result[index + 10]);
-                printf("device mac = %02x%02x%02x%02x%02x%02x\r\n",
-                       Machine_info.mac_addr[0],
-                       Machine_info.mac_addr[1],
-                       Machine_info.mac_addr[2],
-                       Machine_info.mac_addr[3],
-                       Machine_info.mac_addr[4],
-                       Machine_info.mac_addr[5]);
-                // mac地址匹配
-                printf("mac check fail\r\n");
-            }
-        }
-
-        {
-            index++;
-        }
+//     while (count)
+//     {
 
-        count--;
-    }
-    // printf("num =%d\r\n",num);
+//         if (((result[index + 2]) == 0x5A) && ((result[index + 3]) == 0x51))
+//         {
+//             length = ((result[index]) << 8) | ((result[index + 1]));
+//             num++;
+//             printf("num =%d,length=%d\r\n", num, length);
+
+// #if 1
+//             for (int i = 0; i < length; i++)
+//             {
+//                 printf("%02x", result[index + 2 + i]);
+//             }
+// #endif
+//             printf("\r\n");
+
+//             // 匹配mac地址    //计算校验和
+//             if (
+//                 (Machine_info.mac_addr[0] == (result[index + 5])) &&
+//                 (Machine_info.mac_addr[1] == (result[index + 6])) &&
+//                 (Machine_info.mac_addr[2] == (result[index + 7])) &&
+//                 (Machine_info.mac_addr[3] == (result[index + 8])) &&
+//                 (Machine_info.mac_addr[4] == (result[index + 9])) &&
+//                 (Machine_info.mac_addr[5] == (result[index + 10])))
+//             {
+
+//                 // mac地址匹配
+//                 printf("mac check ok\r\n");
+//                 // packetparsing((unsigned char *)&result[index+2]);  //16进制解析数据
+//             }
+//             else
+//             {
+//                 printf("mac = %02x%02x%02x%02x%02x%02x\r\n",
+//                        result[index + 5],
+//                        result[index + 6],
+//                        result[index + 7],
+//                        result[index + 8],
+//                        result[index + 9],
+//                        result[index + 10]);
+//                 printf("device mac = %02x%02x%02x%02x%02x%02x\r\n",
+//                        Machine_info.mac_addr[0],
+//                        Machine_info.mac_addr[1],
+//                        Machine_info.mac_addr[2],
+//                        Machine_info.mac_addr[3],
+//                        Machine_info.mac_addr[4],
+//                        Machine_info.mac_addr[5]);
+//                 // mac地址匹配
+//                 printf("mac check fail\r\n");
+//             }
+//         }
+
+//         {
+//             index++;
+//         }
+
+//         count--;
+//     }
+//     // printf("num =%d\r\n",num);
 
-#if 0
-        if(left_display_refresh == true)
-        {
-          left_display_refresh = false;
-                PIC_display((unsigned char *)dspbuf_left);
-        }   
-            reflashdfpr(dspbuf);
-#endif
-}
+// #if 0
+//         if(left_display_refresh == true)
+//         {
+//           left_display_refresh = false;
+//                 PIC_display((unsigned char *)dspbuf_left);
+//         }   
+//             reflashdfpr(dspbuf);
+// #endif
+// }
 
 /*********************************************************************************
  * function   :   selectionSort

+ 3 - 3
main/yc_protocol.h

@@ -268,7 +268,7 @@ typedef struct
 #define USELESS_DATA_LEN 17
 #define DATA_START_LEN (USELESS_DATA_LEN)
 
-void timer_init(void);
+// void timer_init(void);
 void lora_timer_start(void);
 void lora_timer_restart(void);
 void lora_tiemr_stop(void);
@@ -292,13 +292,13 @@ void loro_gwpair_ack(int destaddr, int sourceaddr, int cmd, int st, char *strd);
 
 // typedef unsigned char u8;
 int findByteSequence(const u8 *array, int arraySize, const u8 *sequence, int sequenceSize, int **positions);
-void analysis_protocol(char *result, int len);
+// void analysis_protocol(char *result, int len);
 
 int reply_ack_func(int cmd, int msg_id, bool is_send, uint8_t *result);
 
 void send_can_I_receive();
 
-void send_pair_ack();
+// void send_pair_ack();
 
 void terminal_send_data(void);
 void update_last_button_info(uint8_t btn);

+ 2 - 75
main/yc_terminal.c

@@ -346,21 +346,6 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
     extern unsigned char *last_paint_buf_right;
     extern uint32_t display_size;
 
-#if 0
-extern unsigned char *tmp_paint_buf;
-
-tmp_paint_buf = heap_caps_malloc(display_size,MALLOC_CAP_8BIT|MALLOC_CAP_SPIRAM);  // 开辟 结构体句柄 所需要的空间
-
-if(tmp_paint_buf!=NULL)
-{
-    //printf("tmp_paint_buf malloc success\r\n");
-}else
-{
-    printf("tmp_paint_buf malloc fail\r\n");
-    heap_caps_free(tmp_paint_buf);
-}
-#endif
-
 #if 1
     last_paint_buf_left = heap_caps_malloc(display_size, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM); // 开辟所需要的空间
 
@@ -476,8 +461,6 @@ if(tmp_paint_buf!=NULL)
         }
     }
 
-    // xTaskCreate( left_screen_task, "left_screen_task", 25*1024, NULL, configMAX_PRIORITIES - 1, NULL);
-
     // idf.py 设置分区
     spiffs_init();
 
@@ -746,35 +729,6 @@ if(tmp_paint_buf!=NULL)
 
 #else
 
-#if USER_DEEP_SLEEP_ENABLE
-    int reson = is_wake_up_reson(); // 返回唤醒的原因
-    printf(" info_init reson = %d\r\n", reson);
-    // idf.py 设置分区
-    spiffs_init();
-
-    /* not a wakeup from ULP, load the firmware */
-    if ((reson != ESP_SLEEP_WAKEUP_ULP) && (reson != ESP_SLEEP_WAKEUP_TIMER))
-    {
-
-#if 1
-        // uint8_t yc_name[6] = {0xd2,0xcf,0xb3,0xb2,0x00,0x00};
-        Machine_info_t default_info = {
-            .left_display_mode = 0,
-            //.left_state =1,
-            .eflagID = 0xFF,
-            .rssi = 0x64,
-            .refresh_cycle = 2,
-            .batt_precent = 100,
-        };
-        spiffs_write(&default_info);
-#endif
-        spiffs_read(&Machine_info);
-    }
-    else
-    {
-    }
-#endif
-
 #if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
     lora_init();
 #endif
@@ -794,40 +748,14 @@ if(tmp_paint_buf!=NULL)
 
 #endif
 
-#if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
-// timer_init();
-#endif
-
-    //////////////////////////////////////////////////////////////////////////////////////////////////
 #endif
 
     xTaskCreate(button_task, "button_task", 5 * 2048, NULL, configMAX_PRIORITIES, NULL);
-
-    // xTaskCreate( right_screen_task, "right_screen_task",15*1024, NULL, configMAX_PRIORITIES - 2, NULL);
     xTaskCreate(screen_task, "screen_task", 40 * 1024, NULL, configMAX_PRIORITIES - 2, NULL);
 
     printf("=================================UPDATE OK===========================\r\n");
-
-#if 1
     xTaskCreate(business_logic_task, "business_logic_task", 25 * 1024, NULL, YC_TASK_NONE, NULL);
-// xTaskCreate( unpack_task, "unpack_task", 5*1024, NULL, YC_TASK_UNPACK, NULL);
-#if !USER_QIXIN //
-    xTaskCreate(lora_task, "lora_task", 5 * 1024, NULL, configMAX_PRIORITIES, NULL);
-
-#endif
-
-#if 0
- xTaskCreate(gui_task, "gui_task", 4096 * 2, NULL, 5, NULL);
-#endif
-
-#if 1 // 任务处理函数
     xTaskCreate(read_deal_data_callback_handler, "read_deal_data_task", 1024 * 8, NULL, configMAX_PRIORITIES, NULL);
-#endif
-
-    // 添加定时发送当前是否有链表数据
-    //  xTaskCreate(Sendlist_task_callback_handler, "Sendlist_task", 1024*8, NULL, configMAX_PRIORITIES, NULL);
-#endif
-
     // 打印系统信息
     print_systenInfo();
 }
@@ -1116,13 +1044,11 @@ static void button_task(void *arg)
                 if (button_info == POWER_ON_INTO_RESET_VALUE) // 进入配网模式
                 {
                     is_change_chanel_ok = false;
-
                     printf("into reset mode\r\n");
-
                     font_exit_sleep();
                     lora_set_power_level(1);
                     uart_sleep_out_config();
-                    beep_blink(2000, 1);
+
                     extern void sleep_timer_stop();
                     extern void Already_send_timer_stop();
 
@@ -1132,6 +1058,7 @@ static void button_task(void *arg)
                     vTaskDelay(300 / portTICK_PERIOD_MS);
                     reset_default(true, 1);
                     reset_lora(LORA_CHANENL);
+                    beep_blink(2000, 1);
                 }
             }
         }