| 
															
																@@ -57,7 +57,7 @@ bool is_first_charge = false; // 当前充电发送只执行一次标志 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 uint8_t charging_flag;
 
															 | 
															
															 | 
															
																 uint8_t charging_flag;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 extern const uint8_t ulp_main_bin_start[] asm("_binary_ulp_main_bin_start");
 
															 | 
															
															 | 
															
																 extern const uint8_t ulp_main_bin_start[] asm("_binary_ulp_main_bin_start");
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 extern const uint8_t ulp_main_bin_end[] asm("_binary_ulp_main_bin_end");
 
															 | 
															
															 | 
															
																 extern const uint8_t ulp_main_bin_end[] asm("_binary_ulp_main_bin_end");
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+extern bool is_paired_sleep;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 static void init_ulp_program(void);
 
															 | 
															
															 | 
															
																 static void init_ulp_program(void);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 extern void app_init();
 
															 | 
															
															 | 
															
																 extern void app_init();
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -94,26 +94,18 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     int lev_2 = 0;
 
															 | 
															
															 | 
															
																     int lev_2 = 0;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     while (true)
 
															 | 
															
															 | 
															
																     while (true)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     {
 
															 | 
															
															 | 
															
																     {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        if (is_key_press() || !is_epd_ok|| !is_epd_ok_cplt)
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (is_key_press() || !is_epd_ok || !is_epd_ok_cplt)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         {
 
															 | 
															
															 | 
															
																         {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            ESP_LOGI(LOG_TAG,"is_key_press() || !is_epd_ok|| !is_epd_ok_cplt");
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            ESP_LOGI(LOG_TAG, "%d %d %d not sleep 1s continue", is_key_press(), !is_epd_ok, !is_epd_ok_cplt);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             vTaskDelay(1000 / portTICK_PERIOD_MS);
 
															 | 
															
															 | 
															
																             vTaskDelay(1000 / portTICK_PERIOD_MS);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            continue; 
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            continue;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         }
 
															 | 
															
															 | 
															
																         }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         extern bool is_sleep;
 
															 | 
															
															 | 
															
																         extern bool is_sleep;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         if (is_sleep == true)
 
															 | 
															
															 | 
															
																         if (is_sleep == true)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         {
 
															 | 
															
															 | 
															
																         {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-// printf("system is ready sleep\r\n");
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#if LORA_SLEEP_ENABLE
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // rtc_gpio_hold_dis(LORA_POWER_PIN);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             lora_set_power_level(0);
 
															 | 
															
															 | 
															
																             lora_set_power_level(0);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-// rtc_gpio_hold_en(LORA_POWER_PIN);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#endif
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 #if USER_LIGHT_SLEEP_ENABLE
 
															 | 
															
															 | 
															
																 #if USER_LIGHT_SLEEP_ENABLE
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            is_first_run = false;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             // ESP_LOGE(LOG_TAG, "start light_sleep ,is_first_run = %d\r\n", is_first_run);
 
															 | 
															
															 | 
															
																             // ESP_LOGE(LOG_TAG, "start light_sleep ,is_first_run = %d\r\n", is_first_run);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             if (Machine_info.power_status == 0) // 关机状态
 
															 | 
															
															 | 
															
																             if (Machine_info.power_status == 0) // 关机状态
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -223,20 +215,15 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 iot_button_stop();
 
															 | 
															
															 | 
															
																                 iot_button_stop();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 adc_oneshot_del_unit(adc1_handle);
 
															 | 
															
															 | 
															
																                 adc_oneshot_del_unit(adc1_handle);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 vTaskDelay(100 / portTICK_PERIOD_MS);
 
															 | 
															
															 | 
															
																                 vTaskDelay(100 / portTICK_PERIOD_MS);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                is_first_run = false;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 esp_deep_sleep_start();
 
															 | 
															
															 | 
															
																                 esp_deep_sleep_start();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 // }
 
															 | 
															
															 | 
															
																                 // }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 // esp_light_sleep_start();
 
															 | 
															
															 | 
															
																                 // esp_light_sleep_start();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             }
 
															 | 
															
															 | 
															
																             }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            else if ((Machine_info.power_status == 1) && Machine_info.paired == 1) // 开机状态且配对
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            /*{
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                ESP_LOGW(LOG_TAG,"//开机状态且配对\r\n");//不进休眠
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            }
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            else if(Machine_info.paired ==0 )*/
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            else if ((Machine_info.power_status == 1) && Machine_info.paired == 1 && is_paired_sleep) // 开机状态且配对
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             {
 
															 | 
															
															 | 
															
																             {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // 重新配置休眠唤醒时间
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // printf("esp_sleep_enable_timer_wakeup ret = %d\n",esp_sleep_enable_timer_wakeup(TIMER_WAKEUP_TIME_US));//配置当前休眠的唤醒时间
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                is_paired_sleep = false; // 只有发送完lora消息后才会进入休眠
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 font_into_sleep();
 
															 | 
															
															 | 
															
																                 font_into_sleep();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 #include "EPD.h"
 
															 | 
															
															 | 
															
																 #include "EPD.h"
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 epd_sleep(SCREEN_LEFT);
 
															 | 
															
															 | 
															
																                 epd_sleep(SCREEN_LEFT);
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -295,39 +282,19 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 #endif
 
															 | 
															
															 | 
															
																 #endif
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#if 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));
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-#endif
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 #endif
 
															 | 
															
															 | 
															
																 #endif
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                // 重新配置休眠唤醒时间
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 esp_sleep_enable_timer_wakeup(TIMER_WAKEUP_TIME_US); // 配置当前休眠的唤醒时间
 
															 | 
															
															 | 
															
																                 esp_sleep_enable_timer_wakeup(TIMER_WAKEUP_TIME_US); // 配置当前休眠的唤醒时间
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                                                                     // adc_oneshot_del_unit(adc1_handle);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // gpio_hold_en(4);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // vTaskDelay(100/ portTICK_PERIOD_MS);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 // OTA 不休眠
 
															 | 
															
															 | 
															
																                 // OTA 不休眠
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 if (!is_adv)
 
															 | 
															
															 | 
															
																                 if (!is_adv)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 {
 
															 | 
															
															 | 
															
																                 {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    // if (!is_key_press())
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    // {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    getRtcTime(&Machine_info);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     ESP_LOGW(LOG_TAG, "-> sleep\r\n");
 
															 | 
															
															 | 
															
																                     ESP_LOGW(LOG_TAG, "-> sleep\r\n");
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     uart_wait_tx_idle_polling(1);                           // 抛出剩余串口1消息
 
															 | 
															
															 | 
															
																                     uart_wait_tx_idle_polling(1);                           // 抛出剩余串口1消息
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM); // 抛出剩余串口0消息
 
															 | 
															
															 | 
															
																                     uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM); // 抛出剩余串口0消息
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     vTaskDelay(100 / portTICK_PERIOD_MS);
 
															 | 
															
															 | 
															
																                     vTaskDelay(100 / portTICK_PERIOD_MS);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    is_first_run = false;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     esp_light_sleep_start();
 
															 | 
															
															 | 
															
																                     esp_light_sleep_start();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    // }
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    // else
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    // {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    //     ESP_LOGW(LOG_TAG, "power key is press\r\n");
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    // }
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 }
 
															 | 
															
															 | 
															
																                 }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 else
 
															 | 
															
															 | 
															
																                 else
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 {
 
															 | 
															
															 | 
															
																                 {
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -335,17 +302,15 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     ESP_LOGW(LOG_TAG, "OTA not sleep");
 
															 | 
															
															 | 
															
																                     ESP_LOGW(LOG_TAG, "OTA not sleep");
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 }
 
															 | 
															
															 | 
															
																                 }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             }
 
															 | 
															
															 | 
															
																             }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            else
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                goto not_sleep;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             is_sleep = false;
 
															 | 
															
															 | 
															
																             is_sleep = false;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 #endif
 
															 | 
															
															 | 
															
																 #endif
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // #if USER_DEEP_SLEEP_ENABLE
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // printf("start deep sleep\r\n");
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // //重新配置休眠唤醒时间
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // esp_sleep_enable_timer_wakeup(TIMER_WAKEUP_TIME_US);  //配置当前休眠的唤醒时间
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // // enter deep sleep
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // esp_deep_sleep_start();
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // #endif
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        not_sleep:
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            ESP_LOGE(LOG_TAG, "is_sleep = %d Machine_info.power_status = %d Machine_info.paired =%d is_paired_sleep = %d not_sleep", is_sleep, Machine_info.power_status, Machine_info.paired, is_paired_sleep);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         }
 
															 | 
															
															 | 
															
																         }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         // char *wakeup_reason = malloc(20*sizeof(uint8_t));
 
															 | 
															
															 | 
															
																         // char *wakeup_reason = malloc(20*sizeof(uint8_t));
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -358,29 +323,7 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         switch (reson)
 
															 | 
															
															 | 
															
																         switch (reson)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         {
 
															 | 
															
															 | 
															
																         {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         case ESP_SLEEP_WAKEUP_TIMER:
 
															 | 
															
															 | 
															
																         case ESP_SLEEP_WAKEUP_TIMER:
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             iot_button_resume();
 
															 | 
															
															 | 
															
																             iot_button_resume();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // // wakeup_reason = "timer";
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // #if LORA_SLEEP_ENABLE
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            //             // rtc_gpio_pullup_dis(LORA_POWER_PIN);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            //             // rtc_gpio_deinit(LORA_POWER_PIN);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            //             // rtc_gpio_init(LORA_POWER_PIN);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            //             // rtc_gpio_set_direction(LORA_POWER_PIN, RTC_GPIO_MODE_OUTPUT_ONLY);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            //             // rtc_gpio_pullup_en(LORA_POWER_PIN);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            //             // rtc_gpio_set_level(LORA_POWER_PIN, 1);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            //             lora_set_power_level(1); // 打开lora电源
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // // rtc_gpio_hold_en(LORA_POWER_PIN);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // #endif
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // #if FONT_SLEEP_ENABLE          // 字库唤醒恢复供电
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            //             font_exit_sleep(); // 退出睡眠
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // #endif
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // #if LCD_SLEEP_ENABLE
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            // #endif
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             if (is_first_run == false)
 
															 | 
															
															 | 
															
																             if (is_first_run == false)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             {
 
															 | 
															
															 | 
															
																             {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 lora_set_power_level(1); // 打开lora电源
 
															 | 
															
															 | 
															
																                 lora_set_power_level(1); // 打开lora电源
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -432,6 +375,8 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 // Machine_info.eflagID = 0x01;
 
															 | 
															
															 | 
															
																                 // Machine_info.eflagID = 0x01;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 // Already_send_timer_stop();
 
															 | 
															
															 | 
															
																                 // Already_send_timer_stop();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 Already_send_timer_start(LORA_POWER_TIME + (Machine_info.eflagID * TIMER_CAN_SEND_TIME));
 
															 | 
															
															 | 
															
																                 Already_send_timer_start(LORA_POWER_TIME + (Machine_info.eflagID * TIMER_CAN_SEND_TIME));
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                // Already_send_timer_start(LORA_POWER_TIME +2000);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 // sleep_timer_start(700);  //进入睡眠
 
															 | 
															
															 | 
															
																                 // sleep_timer_start(700);  //进入睡眠
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 is_first_run = true;
 
															 | 
															
															 | 
															
																                 is_first_run = true;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             }
 
															 | 
															
															 | 
															
																             }
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -516,6 +461,11 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             break;
 
															 | 
															
															 | 
															
																             break;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         case ESP_SLEEP_WAKEUP_ULP:
 
															 | 
															
															 | 
															
																         case ESP_SLEEP_WAKEUP_ULP:
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             iot_button_resume();
 
															 | 
															
															 | 
															
																             iot_button_resume();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (Machine_info.paired == 1)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                is_paired_sleep = true;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                ESP_LOGW(LOG_TAG, "is_paired_sleep = true");
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             break;
 
															 | 
															
															 | 
															
																             break;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         case ESP_SLEEP_WAKEUP_EXT0:
 
															 | 
															
															 | 
															
																         case ESP_SLEEP_WAKEUP_EXT0:
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -534,6 +484,7 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             break;
 
															 | 
															
															 | 
															
																             break;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         }
 
															 | 
															
															 | 
															
																         }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        // 先屏蔽电量刷屏部分代码2024.1.11
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         /* extern bool is_adv;
 
															 | 
															
															 | 
															
																         /* extern bool is_adv;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																          if(is_adv)//OTA 模式不检测电量
 
															 | 
															
															 | 
															
																          if(is_adv)//OTA 模式不检测电量
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																          {
 
															 | 
															
															 | 
															
																          {
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -548,7 +499,7 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         {
 
															 | 
															
															 | 
															
																         {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             if (read_battery_voltage() == 0)
 
															 | 
															
															 | 
															
																             if (read_battery_voltage() == 0)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             {
 
															 | 
															
															 | 
															
																             {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                ESP_LOGE(LOG_TAG,"-->low batt!!!! , power off\r\n");
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                ESP_LOGE(LOG_TAG, "-->low batt!!!! , power off\r\n");
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 #if 0
 
															 | 
															
															 | 
															
																 #if 0
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 set_screen_dis_info_and_send_queue(false, false, false, false,100);
 
															 | 
															
															 | 
															
																                 set_screen_dis_info_and_send_queue(false, false, false, false,100);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 set_screen_dis_info_and_send_queue(true, false, true, false,100);
 
															 | 
															
															 | 
															
																                 set_screen_dis_info_and_send_queue(true, false, true, false,100);
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -596,8 +547,8 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             {
 
															 | 
															
															 | 
															
																             {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 bat_times = 0;
 
															 | 
															
															 | 
															
																                 bat_times = 0;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 Machine_info.batt_precent = read_battery_voltage();
 
															 | 
															
															 | 
															
																                 Machine_info.batt_precent = read_battery_voltage();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                printf("compare current bat and last bat refresh display,current = %d,last =%d\r\n", Machine_info.batt_precent, Machine_info.last_batt_precent);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                user_compare(Machine_info.last_batt_precent, Machine_info.batt_precent); // 刷完左屏,比较一次电量。电量值不同则刷一次右屏
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                // printf("compare current bat and last bat refresh display,current = %d,last =%d\r\n", Machine_info.batt_precent, Machine_info.last_batt_precent);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                // user_compare(Machine_info.last_batt_precent, Machine_info.batt_precent); // 刷完左屏,比较一次电量。电量值不同则刷一次右屏
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 Machine_info.last_batt_precent = Machine_info.batt_precent;
 
															 | 
															
															 | 
															
																                 Machine_info.last_batt_precent = Machine_info.batt_precent;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             }
 
															 | 
															
															 | 
															
																             }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         }
 
															 | 
															
															 | 
															
																         }
 
															 |