Jelajahi Sumber

增加开机5分钟未配网,自动关机

wanghechen 7 bulan lalu
induk
melakukan
cea85914f7
7 mengubah file dengan 106 tambahan dan 140 penghapusan
  1. 2 1
      .vscode/settings.json
  2. 36 73
      main/ulp_riscv_adc_example_main.c
  3. 1 0
      main/user_config.h
  4. 32 3
      main/user_sleep.c
  5. 16 18
      main/yc_paint.c
  6. 2 0
      main/yc_protocol.c
  7. 17 45
      main/yc_terminal.c

+ 2 - 1
.vscode/settings.json

@@ -35,6 +35,7 @@
         "esp_compiler.h": "c",
         "*.tcc": "c",
         "unordered_map": "c",
-        "iot_button.h": "c"
+        "iot_button.h": "c",
+        "gpio.h": "c"
     }
 }

+ 36 - 73
main/ulp_riscv_adc_example_main.c

@@ -79,7 +79,42 @@ bool read_charge_is_running()
 {
     return true;
 }
+void goto_deep_sleep(void)
+{
+    lora_set_power_level(0);
+    font_into_sleep();
+
+    epd_sleep(SCREEN_LEFT);
+    epd_sleep(SCREEN_RIGHT);
+
+    esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
+
+    gpio_reset_pin(4);
+    int ext_wakeup_pin_0 = 4;
+    ESP_ERROR_CHECK(esp_sleep_enable_ext0_wakeup(ext_wakeup_pin_0, 0));
+
+    ESP_ERROR_CHECK(rtc_gpio_pullup_en(ext_wakeup_pin_0));
+    ESP_ERROR_CHECK(rtc_gpio_pulldown_dis(ext_wakeup_pin_0));
+
+    // 充电按键
 
+    gpio_reset_pin(2);
+    const int ext_wakeup_pin_1 = 2;
+    const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
+    // printf("Enabling EXT1 wakeup on pins GPIO %d\r\n", ext_wakeup_pin_1);
+    ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask, ESP_EXT1_WAKEUP_ALL_LOW));
+
+    esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
+    ESP_ERROR_CHECK(esp_sleep_enable_ulp_wakeup());
+
+    printf("=>deep sleep\r\n");
+    uart_wait_tx_idle_polling(1); // 抛出剩余串口1消息
+    uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
+    iot_button_stop();
+    adc_oneshot_del_unit(adc1_handle);
+    is_first_run = false;
+    esp_deep_sleep_start();
+}
 static void light_sleep_task(void *args)
 {
     // if(Machine_info.eflagID != 0xff)  //如果未分配ID
@@ -108,79 +143,7 @@ static void light_sleep_task(void *args)
 
             if (Machine_info.power_status == 0) // 关机状态
             {
-                lora_set_power_level(0);
-
-                font_into_sleep();
-#include "EPD.h"
-                epd_sleep(SCREEN_LEFT);
-                epd_sleep(SCREEN_RIGHT);
-
-                // gpio_hold_en(PIN_L_CS);
-                // gpio_hold_en(PIN_R_CS);
-
-                // gpio_set_level(PIN_L_CS,1);
-                // gpio_set_level(PIN_R_CS,1);
-                // gpio_reset_pin(46);
-
-                // uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
-                // ESP_ERROR_CHECK(uart_wait_tx_done(UART_NUM_1,portMAX_DELAY));
-                esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
-
-#if 1 // 电源按键
-
-                gpio_reset_pin(4);
-                int ext_wakeup_pin_0 = 4;
-                // printf("Enabling EXT0 wakeup on pin GPIO%d\n", ext_wakeup_pin_0);
-                ESP_ERROR_CHECK(esp_sleep_enable_ext0_wakeup(ext_wakeup_pin_0, 0));
-
-                // Configure pullup/downs via RTCIO to tie wakeup pins to inactive level during deepsleep.
-                // EXT0 resides in the same power domain (RTC_PERIPH) as the RTC IO pullup/downs.
-                // No need to keep that power domain explicitly, unlike EXT1.
-                ESP_ERROR_CHECK(rtc_gpio_pullup_en(ext_wakeup_pin_0));
-                ESP_ERROR_CHECK(rtc_gpio_pulldown_dis(ext_wakeup_pin_0));
-
-#endif
-
-                // 充电按键
-
-#if 0
-                                // adc_oneshot_del_unit(adc1_handle);
-                                gpio_reset_pin(2);
-                                int ext_wakeup_pin_1 = 2;
-                                //printf("Enabling EXT0 wakeup on pin GPIO%d\n", ext_wakeup_pin_0);
-                                ESP_ERROR_CHECK(esp_sleep_enable_ext0_wakeup(ext_wakeup_pin_1, 0));
-
-                                // Configure pullup/downs via RTCIO to tie wakeup pins to inactive level during deepsleep.
-                                // EXT0 resides in the same power domain (RTC_PERIPH) as the RTC IO pullup/downs.
-                                // No need to keep that power domain explicitly, unlike EXT1.
-                                ESP_ERROR_CHECK(rtc_gpio_pullup_en(ext_wakeup_pin_1));
-                                ESP_ERROR_CHECK(rtc_gpio_pulldown_dis(ext_wakeup_pin_1));
-                                //gpio_hold_en(4);
-#else
-                gpio_reset_pin(2);
-                const int ext_wakeup_pin_1 = 2;
-                const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
-                // printf("Enabling EXT1 wakeup on pins GPIO %d\r\n", ext_wakeup_pin_1);
-                ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask, ESP_EXT1_WAKEUP_ALL_LOW));
-
-#endif
-
-                esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
-                ESP_ERROR_CHECK(esp_sleep_enable_ulp_wakeup());
-
-                // if (!is_key_press())
-                // {
-                printf("=>deep sleep\r\n");
-                uart_wait_tx_idle_polling(1); // 抛出剩余串口1消息
-                uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
-                iot_button_stop();
-                adc_oneshot_del_unit(adc1_handle);
-                // vTaskDelay(100 / portTICK_PERIOD_MS);
-                is_first_run = false;
-                esp_deep_sleep_start();
-                // }
-
-                // esp_light_sleep_start();
+                goto_deep_sleep();
             }
             else if ((Machine_info.power_status == 1) && Machine_info.paired == 1 && is_paired_sleep) // 开机状态且配对
             {

+ 1 - 0
main/user_config.h

@@ -106,4 +106,5 @@ void reset_default(bool is_dis, uint8_t power_status);
 
 void Paint_leftScreen(bool is_poweron, bool is_test);
 void Paint_rightScreen(bool is_poweron, bool is_test);
+void goto_deep_sleep(void);
 #endif

+ 32 - 3
main/user_sleep.c

@@ -29,9 +29,10 @@
 #define TIMER_CHOICE 1 // 0:ESP  //1 FREERTOS
 
 #if TIMER_CHOICE
-bool is_paired_sleep = false;//配对后进入休眠标志,防止串口1数据错乱
+bool is_paired_sleep = false;     // 配对后进入休眠标志,防止串口1数据错乱
 TimerHandle_t sleep_timer;        // 进入休眠定时器
 TimerHandle_t already_send_timer; // 可以发送数据的定时器
+TimerHandle_t power_sleep_timer;  // 开机睡眠的定时器
 #else
 esp_timer_handle_t sleep_timer;        // 开启睡眠定时器
 esp_timer_handle_t already_send_timer; // 可以发送数据的定时器
@@ -194,7 +195,7 @@ void Already_send_timer_callback(void *arg)
 
 #if 1
     is_paired_sleep = true;
-     ESP_LOGW(LOG_TAG,"2is_paired_sleep = true");
+    ESP_LOGW(LOG_TAG, "2is_paired_sleep = true");
     sleep_timer_start(500); // 进入睡眠
 #endif
 
@@ -222,7 +223,17 @@ void Already_send_timer_callback(void *arg)
 
 #endif
 }
+void power_sleep_timer_callback(void *arg)
+{
 
+    if (Machine_info.paired == 1)
+    {
+        ESP_LOGE(LOG_TAG, "power_sleep_timer_callback return");
+        return;
+    }
+    set_screen_dis_info_and_send_queue(false, true, true, false, 5000); // 关机
+    set_screen_dis_info_and_send_queue(true, false, false, false, 5000);
+}
 /*********************************************************************************
  * function   :   Already_send_timer_start
  * Description :  定到达指定时间准备发送数据或者接收数据
@@ -243,6 +254,14 @@ void Already_send_timer_start(int ms)
 #endif
 }
 
+void power_sleep_timer_start(void)
+{
+    xTimerStop(power_sleep_timer, 0); // 停止定时器
+    // 在这里可以改变定时器的超时时间+
+    // 第一个参数是定时器句柄,第二个参数是新的超时时间(以时钟节拍为单位)
+    xTimerChangePeriod(power_sleep_timer, pdMS_TO_TICKS(5*60 * 1000), 0);
+    xTimerStart(power_sleep_timer, 0); // 开始定时器
+}
 /*********************************************************************************
  * function   :   Already_send_timer_stop
  * Description :  停止定时器
@@ -260,7 +279,10 @@ void Already_send_timer_stop(void)
 
 #endif
 }
-
+void power_sleep_timer_stop(void)
+{
+    xTimerStop(power_sleep_timer, 0); // 停止定时器
+}
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /*定时器唤醒*/
 #include "esp_check.h"
@@ -416,6 +438,13 @@ void user_sleep_into()
         0,                          // 定时器ID(可以为0)
         Already_send_timer_callback // 定时器回调函数
     );
+    power_sleep_timer = xTimerCreate(
+        "power_sleep_timer",       // 定时器名称(可以为NULL)
+        pdMS_TO_TICKS(5*60 * 1000),  // 定时器超时时间(以毫秒为单位)
+        pdFALSE,                   // 定时器为周期性(pdTRUE)还是单次(pdFALSE)
+        0,                         // 定时器ID(可以为0)
+        power_sleep_timer_callback // 定时器回调函数
+    );
 
 #endif
 

+ 16 - 18
main/yc_paint.c

@@ -632,25 +632,19 @@ static uint8_t *partial_right1_quick(Machine_info_t *info)
     {
     case 0:
         break;
-    case 1 ... 24:
+    case 1 ... 25:
         Paint_DrawRectangle(433 - BAT_X_OFFSET, 27, 439 - BAT_X_OFFSET, 41, WHITE, 1, 1);
         break;
-    case 25 ... 49:
+    case 26 ... 50:
         Paint_DrawRectangle(433 - BAT_X_OFFSET, 27, 439 - BAT_X_OFFSET, 41, WHITE, 1, 1);
         Paint_DrawRectangle(441 - BAT_X_OFFSET, 27, 447 - BAT_X_OFFSET, 41, WHITE, 1, 1);
         break;
-    case 50 ... 74:
+    case 51 ... 75:
         Paint_DrawRectangle(433 - BAT_X_OFFSET, 27, 439 - BAT_X_OFFSET, 41, WHITE, 1, 1);
         Paint_DrawRectangle(441 - BAT_X_OFFSET, 27, 447 - BAT_X_OFFSET, 41, WHITE, 1, 1);
         Paint_DrawRectangle(449 - BAT_X_OFFSET, 27, 455 - BAT_X_OFFSET, 41, WHITE, 1, 1);
         break;
-    case 75 ... 99:
-        Paint_DrawRectangle(433 - BAT_X_OFFSET, 27, 439 - BAT_X_OFFSET, 41, WHITE, 1, 1);
-        Paint_DrawRectangle(441 - BAT_X_OFFSET, 27, 447 - BAT_X_OFFSET, 41, WHITE, 1, 1);
-        Paint_DrawRectangle(449 - BAT_X_OFFSET, 27, 455 - BAT_X_OFFSET, 41, WHITE, 1, 1);
-        Paint_DrawRectangle(457 - BAT_X_OFFSET, 27, 462 - BAT_X_OFFSET, 41, WHITE, 1, 1);
-        break;
-    case 100:
+    case 76 ... 100:
         Paint_DrawRectangle(433 - BAT_X_OFFSET, 27, 439 - BAT_X_OFFSET, 41, WHITE, 1, 1);
         Paint_DrawRectangle(441 - BAT_X_OFFSET, 27, 447 - BAT_X_OFFSET, 41, WHITE, 1, 1);
         Paint_DrawRectangle(449 - BAT_X_OFFSET, 27, 455 - BAT_X_OFFSET, 41, WHITE, 1, 1);
@@ -910,26 +904,27 @@ static uint8_t *partial_right3_quick(void)
     Paint_DrawString_EN(300 + x, 70, (char *)arr_string, &ascii_type_16x32, FONT_FOREGROUND, FONT_BACKGROUND);
 
     uint32_t tmp = 0;
-    for (i = 0; i < 5; i++)
+    memset(arr_string, 0, 20);
+    sprintf(arr_string, "%lu", num_max);
+    Paint_DrawString_EN(10, 48, (char *)arr_string, &ascii_type_5x7, FONT_FOREGROUND, FONT_BACKGROUND);
+    for (i = 1; i < 5; i++)
     {
         memset(arr_string, 0, 20); // 140 5
         tmp = (num_max / 5) * (5 - i);
-        // strcpy(arr_string,tmp);
-        // itoa(tmp,arr_string,10);//这里导致数值错误
         sprintf(arr_string, "%lu", tmp);
         // ESP_LOGW(LOG_TAG,"%s",arr_string);
-        Paint_DrawString_EN(10, 48 + i * 30, (char *)arr_string, &ascii_type_5x7, FONT_FOREGROUND, FONT_BACKGROUND);
+        Paint_DrawString_EN(10, 48 + i * 38, (char *)arr_string, &ascii_type_5x7, FONT_FOREGROUND, FONT_BACKGROUND);
         // Paint_DrawString_EN(20,40+i*28,(char*)arr_string, &ascii_type_8x16,FONT_FOREGROUND,FONT_BACKGROUND );
     }
 
-    for (i = 0; i < 5; i++) // ur yr y坐标
+    for (i = 0; i < 4; i++) // ur yr y坐标
     {
         memset(arr_string, 0, 20);
-        tmp = (100 / 5) * (5 - i);
+        tmp = (100 / 4) * (4 - i);
         // strcpy(arr_string,tmp);
         itoa(tmp, arr_string, 10);
         strcat(arr_string, ".00%");
-        Paint_DrawString_EN(60 + 200, 48 + i * 30, (char *)arr_string, &ascii_type_5x7, FONT_FOREGROUND, FONT_BACKGROUND);
+        Paint_DrawString_EN(60 + 200, 48 + i * 38, (char *)arr_string, &ascii_type_5x7, FONT_FOREGROUND, FONT_BACKGROUND);
     }
 
     char str_ur[8] = {0xbc, 0xda, 0xb6, 0xaf, 0xc2, 0xca, 0x00, 0x00};
@@ -1386,7 +1381,9 @@ static void dis_right_sms(void)
     memset((uint8_t *)tmp_paint_buf, 0, DISPLAY_BUFFER_SIZE /*sizeof(tmp_paint_buf)*/);
     Paint_NewImage((uint8_t *)tmp_paint_buf, 648, 480, ROTATE_270, WHITE);
     Paint_DrawBitMap_Paste(gImage_right_instruction, 0, 0, 480, 648, 1);
-
+    //关机显示工站名称
+    int x = center_align(Machine_info.station_name, 480, 16, 32);
+    Paint_DrawString_CN(x, 25, &Machine_info.station_name, &chinese_type_32, FONT_FOREGROUND, FONT_BACKGROUND);
     if (!decection_state_0()) // 判断充电中逻辑
     {
 
@@ -1444,6 +1441,7 @@ static void dis_right_sms(void)
         if (read_battery_voltage() < 10)
         {
             Paint_DrawBitMap_Paste(gImage_low_batt, 30, 428, 420, 154, 1); // 低电量请充电
+            Paint_DrawRectangle(30, 428+154, 420, 640, BLACK, 1, 1);
         }
     }
 

+ 2 - 0
main/yc_protocol.c

@@ -1460,6 +1460,8 @@ static void hardware_ungwpair_func(const LORA_DATA_T *buf)
     // dymatic_change_chanel(Machine_info.lora_factory_channel);  //切换信道
     reset_lora(LORA_CHANENL);
     Machine_info.paired = 0; // 解除配对
+    extern void power_sleep_timer_start(void);
+    power_sleep_timer_start();
 }
 /*网关收到终端发送的数据 ACK 终端收到用于删除当前的msgid的数据*/
 static void hardware_ack_delete_msg_id(const LORA_DATA_T *buf)

+ 17 - 45
main/yc_terminal.c

@@ -398,6 +398,7 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
         screen_dis_info.is_left = false;
         while (1)
         {
+            ESP_LOGW(LOG_TAG, "ESP_SLEEP_WAKEUP_EXT1 while (1)");
             // value++;
             charge_key = gpio_get_level(2);
 
@@ -450,6 +451,9 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
                 const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
                 printf("Enabling EXT1 wakeup on pins GPIO%d\r\n", ext_wakeup_pin_1);
                 ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask, ESP_EXT1_WAKEUP_ALL_LOW));
+                esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
+
+                ESP_ERROR_CHECK(esp_sleep_enable_ulp_wakeup());
 
 #endif
                 esp_deep_sleep_start();
@@ -539,7 +543,9 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
                     const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
                     printf("Enabling EXT1 wakeup on pins GPIO%d\r\n", ext_wakeup_pin_1);
                     ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask, ESP_EXT1_WAKEUP_ALL_LOW));
+                    esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
 
+                    ESP_ERROR_CHECK(esp_sleep_enable_ulp_wakeup());
 #endif
                     esp_deep_sleep_start();
                 }
@@ -550,6 +556,8 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
 #if 1                                       // USER_DEEP_SLEEP_ENABLE
                 reson = is_wake_up_reson(); // 返回唤醒的原因
                 ESP_LOGW(LOG_TAG, "power on- reson = %d\r\n", reson);
+                extern void power_sleep_timer_start(void);
+                power_sleep_timer_start();
                 /* ULP Risc-V read and detected a temperature above the limit */
                 if (reson == ESP_SLEEP_WAKEUP_EXT0)
                 {
@@ -560,12 +568,12 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
                         gpio_set_level(LORA_RXD_PIN, 0);
                         lora_set_power_level(1); // 打开lora电源
 
-                        beep_start_ms(1000);
                         // 恢复串口i功能
                         uart_sleep_out_config();
 
                         Machine_info.left_current_Quick_refresh_time = 5;
-                        vTaskDelay(1000 / portTICK_PERIOD_MS);
+                        beep_start_ms(1000);
+                        // vTaskDelay(1000 / portTICK_PERIOD_MS);
                         // printf("开机刷屏\r\n");
                         // if(xQueueSend(screen_queue,&Machine_info,portMAX_DELAY) != true)
                         // {
@@ -604,7 +612,9 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
                 const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
                 printf("Enabling EXT1 wakeup on pins GPIO%d\r\n", ext_wakeup_pin_1);
                 ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask, ESP_EXT1_WAKEUP_ALL_LOW));
+                esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
 
+                ESP_ERROR_CHECK(esp_sleep_enable_ulp_wakeup());
 #endif
                 esp_deep_sleep_start();
             }
@@ -633,47 +643,6 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
                 ESP_LOGW(LOG_TAG, "left key press power off\r\n");
                 uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
 
-#if 1
-                font_into_sleep();
-#include "EPD.h"
-                epd_sleep(SCREEN_LEFT);
-                epd_sleep(SCREEN_RIGHT);
-
-                // gpio_hold_en(PIN_L_CS);
-                // gpio_hold_en(PIN_R_CS);
-
-                // gpio_set_level(PIN_L_CS,1);
-                // gpio_set_level(PIN_R_CS,1);
-                // gpio_reset_pin(46);
-
-                // uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
-                // ESP_ERROR_CHECK(uart_wait_tx_done(UART_NUM_1,portMAX_DELAY));
-                esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
-
-                // gpio_set_level(LORA_TXD_PIN, 0);
-                // gpio_set_level(LORA_RXD_PIN, 0);
-
-                // uart_sleep_in_config();
-                uart_driver_delete(UART_NUM_1);
-                gpio_reset_pin(LORA_TXD_PIN);
-                gpio_reset_pin(LORA_RXD_PIN);
-
-                gpio_config_t io_conf = {};
-                io_conf.pin_bit_mask = (1 << LORA_TXD_PIN);
-                io_conf.mode = GPIO_MODE_OUTPUT;
-                io_conf.pull_up_en = false;
-                gpio_config(&io_conf);
-
-                io_conf.pin_bit_mask = (1 << LORA_RXD_PIN);
-                io_conf.mode = GPIO_MODE_OUTPUT;
-                io_conf.pull_up_en = false;
-                gpio_config(&io_conf);
-
-                gpio_set_level(LORA_TXD_PIN, 0);
-                gpio_set_level(LORA_RXD_PIN, 0);
-                gpio_hold_en(LORA_TXD_PIN);
-                gpio_hold_en(LORA_RXD_PIN);
-
                 // 电源按键
                 //  adc_oneshot_del_unit(adc1_handle);
                 gpio_reset_pin(4);
@@ -697,7 +666,6 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
                 esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
                 ESP_ERROR_CHECK(esp_sleep_enable_ulp_wakeup());
 
-#endif
                 printf("esp_deep_sleep_start\r\n");
                 esp_deep_sleep_start();
             }
@@ -716,7 +684,8 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
 
                 while (1)
                 {
-                    vTaskDelay(20 / portTICK_PERIOD_MS);
+                    vTaskDelay(1000 / portTICK_PERIOD_MS);
+                    ESP_LOGE(LOG_TAG, "while (1)");
                 }
             }
         }
@@ -1052,6 +1021,9 @@ static void button_task(void *arg)
                     extern void sleep_timer_stop();
                     extern void Already_send_timer_stop();
 
+                    extern void power_sleep_timer_start(void);
+                    power_sleep_timer_start();
+
                     sleep_timer_stop();
                     Already_send_timer_stop();