| 
															
																@@ -94,9 +94,9 @@ 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|| !is_change_chanel_ok)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         {
 
															 | 
															
															 | 
															
																         {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            ESP_LOGI(LOG_TAG, "%d %d %d not sleep 1s continue", is_key_press(), !is_epd_ok, !is_epd_ok_cplt);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            ESP_LOGI(LOG_TAG, "%d %d %d %dnot sleep 1s continue", is_key_press(), !is_epd_ok, !is_epd_ok_cplt,!is_change_chanel_ok);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             vTaskDelay(1000 / portTICK_PERIOD_MS);
 
															 | 
															
															 | 
															
																             vTaskDelay(1000 / portTICK_PERIOD_MS);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             continue;
 
															 | 
															
															 | 
															
																             continue;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         }
 
															 | 
															
															 | 
															
																         }
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -176,7 +176,7 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
 
															 | 
															
															 | 
															
																                 uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 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;
 
															 | 
															
															 | 
															
																                 is_first_run = false;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 esp_deep_sleep_start();
 
															 | 
															
															 | 
															
																                 esp_deep_sleep_start();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 // }
 
															 | 
															
															 | 
															
																                 // }
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -255,7 +255,7 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     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;
 
															 | 
															
															 | 
															
																                     is_first_run = false;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     esp_light_sleep_start();
 
															 | 
															
															 | 
															
																                     esp_light_sleep_start();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 }
 
															 | 
															
															 | 
															
																                 }
 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -302,45 +302,42 @@ static void light_sleep_task(void *args) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 Machine_info.wait_send_rssi_bat++;
 
															 | 
															
															 | 
															
																                 Machine_info.wait_send_rssi_bat++;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 printf("weakup: bat %d wait_send_rssi_bat = %d,\r\n", Machine_info.batt_precent, Machine_info.wait_send_rssi_bat);
 
															 | 
															
															 | 
															
																                 printf("weakup: bat %d wait_send_rssi_bat = %d,\r\n", Machine_info.batt_precent, Machine_info.wait_send_rssi_bat);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // 打印待发数据
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                printList(Send_list);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // if(Machine_info.wait_send_rssi_bat>(30*60/TIMER_WAKEUP_TIME_S))//30分钟发一次lora
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                if (Machine_info.wait_send_rssi_bat > 60) // 30分钟唤醒一次->(30*60/TIMER_WAKEUP_TIME_S) = 60
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // if (Machine_info.wait_send_rssi_bat>10)
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                if (Machine_info.paired == 1)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 {
 
															 | 
															
															 | 
															
																                 {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    ESP_LOGE(LOG_TAG, "-> 30minite send lora info");
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    Machine_info.wait_send_rssi_bat = 0;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    // f_send_test();
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    f_send_get_chart_data();
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    // f_send_lora_rssi(Machine_info.rssi);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    f_send_battary_vaule(Machine_info.batt_precent);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    f_send_get_time();
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                }
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                if ((Machine_info.last_button.Minute != Machine_info.min) /*||(Machine_info.last_button.Hour != Machine_info.Hour)*/) //
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                {
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    if (is_sync_time(&Machine_info)) // 同步到时间
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    printList(Send_list); // 打印待发数据
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    // if(Machine_info.wait_send_rssi_bat>(30*60/TIMER_WAKEUP_TIME_S))//30分钟发一次lora
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    if (Machine_info.wait_send_rssi_bat > 60) // 30分钟唤醒一次->(30*60/TIMER_WAKEUP_TIME_S) = 60
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    // if (Machine_info.wait_send_rssi_bat>10)
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     {
 
															 | 
															
															 | 
															
																                     {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        ESP_LOGW(LOG_TAG, "update left value min %d,last min %d\r\n", Machine_info.min, Machine_info.last_button.Minute);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        Machine_info.last_button.time_min += (Machine_info.min - Machine_info.last_button.Minute);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        ESP_LOGE(LOG_TAG, "-> 30minite send lora info");
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        Machine_info.wait_send_rssi_bat = 0;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        // f_send_test();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        f_send_get_time();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        f_send_get_chart_data();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        // f_send_lora_rssi(Machine_info.rssi);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        f_send_battary_vaule(Machine_info.batt_precent);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     }
 
															 | 
															
															 | 
															
																                     }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    else
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    if ((Machine_info.last_button.Minute != Machine_info.min) /*||(Machine_info.last_button.Hour != Machine_info.Hour)*/) //
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     {
 
															 | 
															
															 | 
															
																                     {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        printf("time not sync\r\n");
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        if (is_sync_time(&Machine_info)) // 同步到时间
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            ESP_LOGW(LOG_TAG, "update left value min %d,last min %d\r\n", Machine_info.min, Machine_info.last_button.Minute);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            Machine_info.last_button.time_min += (Machine_info.min - Machine_info.last_button.Minute);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        else
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        {
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            printf("time not sync\r\n");
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     }
 
															 | 
															
															 | 
															
																                     }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                }
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // printf("wake reason: %s, slept for %lld ms\n",
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // wakeup_reason,(sleep_afterr_us - sleep_before_us) / 1000);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                printf("start timer id = %d,%d\r\n", Machine_info.eflagID, Machine_info.eflagID * TIMER_CAN_SEND_TIME);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // Machine_info.eflagID = 0x01;
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // Already_send_timer_stop();
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                Already_send_timer_start(LORA_POWER_TIME + (Machine_info.eflagID * TIMER_CAN_SEND_TIME));
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    printf("start timer id = %d,%d\r\n", Machine_info.eflagID, Machine_info.eflagID * TIMER_CAN_SEND_TIME);
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // Already_send_timer_start(LORA_POWER_TIME +2000);
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                // sleep_timer_start(700);  //进入睡眠
 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    // Already_send_timer_stop();
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    Already_send_timer_start(LORA_POWER_TIME + (Machine_info.eflagID * TIMER_CAN_SEND_TIME));
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 is_first_run = true;
 
															 | 
															
															 | 
															
																                 is_first_run = true;
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             }
 
															 | 
															
															 | 
															
																             }
 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
 
															 | 
															
															 | 
															
																 
 
															 |