|
@@ -103,20 +103,14 @@ static void light_sleep_task(void *args)
|
|
extern bool is_sleep;
|
|
extern bool is_sleep;
|
|
if (is_sleep == true)
|
|
if (is_sleep == true)
|
|
{
|
|
{
|
|
- lora_set_power_level(0);
|
|
|
|
|
|
+ // lora_set_power_level(0);
|
|
#if USER_LIGHT_SLEEP_ENABLE
|
|
#if USER_LIGHT_SLEEP_ENABLE
|
|
-
|
|
|
|
// 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) // 关机状态
|
|
{
|
|
{
|
|
- // #if LORA_SLEEP_ENABLE
|
|
|
|
- // rtc_gpio_hold_dis(LORA_POWER_PIN);
|
|
|
|
- // lora_set_power_level(0);
|
|
|
|
- // rtc_gpio_hold_en(LORA_POWER_PIN);
|
|
|
|
- // #endif
|
|
|
|
|
|
+ lora_set_power_level(0);
|
|
|
|
|
|
-#if 1
|
|
|
|
font_into_sleep();
|
|
font_into_sleep();
|
|
#include "EPD.h"
|
|
#include "EPD.h"
|
|
epd_sleep(SCREEN_LEFT);
|
|
epd_sleep(SCREEN_LEFT);
|
|
@@ -133,38 +127,6 @@ static void light_sleep_task(void *args)
|
|
// ESP_ERROR_CHECK(uart_wait_tx_done(UART_NUM_1,portMAX_DELAY));
|
|
// ESP_ERROR_CHECK(uart_wait_tx_done(UART_NUM_1,portMAX_DELAY));
|
|
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
|
|
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
|
|
|
|
|
|
- // gpio_set_level(LORA_TXD_PIN, 0);
|
|
|
|
- // gpio_set_level(LORA_RXD_PIN, 0);
|
|
|
|
-
|
|
|
|
-#if 0
|
|
|
|
- //uart_sleep_in_config();
|
|
|
|
- uart_driver_delete(UART_NUM_1);
|
|
|
|
- gpio_reset_pin(LORA_TXD_PIN);
|
|
|
|
- gpio_reset_pin(LORA_RXD_PIN);
|
|
|
|
-
|
|
|
|
- gpio_config_t io_conf = {};
|
|
|
|
- io_conf.pin_bit_mask = (1<<LORA_TXD_PIN);
|
|
|
|
- io_conf.mode = GPIO_MODE_OUTPUT;
|
|
|
|
- io_conf.pull_up_en = false;
|
|
|
|
- gpio_config(&io_conf);
|
|
|
|
-
|
|
|
|
- io_conf.pin_bit_mask = (1<<LORA_RXD_PIN);
|
|
|
|
- io_conf.mode = GPIO_MODE_OUTPUT;
|
|
|
|
- io_conf.pull_up_en = false;
|
|
|
|
- gpio_config(&io_conf);
|
|
|
|
-
|
|
|
|
- gpio_set_level(LORA_TXD_PIN, 0);
|
|
|
|
- gpio_set_level(LORA_RXD_PIN, 0);
|
|
|
|
- gpio_hold_en(LORA_TXD_PIN);
|
|
|
|
- gpio_hold_en(LORA_RXD_PIN);
|
|
|
|
-#endif
|
|
|
|
-// uart_sleep_out_config();
|
|
|
|
-// uart_driver_delete(UART_NUM_1);
|
|
|
|
-// esp_deep_sleep_start();
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- // vTaskDelay(100/ portTICK_PERIOD_MS);
|
|
|
|
-
|
|
|
|
#if 1 // 电源按键
|
|
#if 1 // 电源按键
|
|
|
|
|
|
gpio_reset_pin(4);
|
|
gpio_reset_pin(4);
|
|
@@ -223,6 +185,7 @@ static void light_sleep_task(void *args)
|
|
}
|
|
}
|
|
else if ((Machine_info.power_status == 1) && Machine_info.paired == 1 && is_paired_sleep) // 开机状态且配对
|
|
else if ((Machine_info.power_status == 1) && Machine_info.paired == 1 && is_paired_sleep) // 开机状态且配对
|
|
{
|
|
{
|
|
|
|
+ lora_set_power_level(0);
|
|
is_paired_sleep = false; // 只有发送完lora消息后才会进入休眠
|
|
is_paired_sleep = false; // 只有发送完lora消息后才会进入休眠
|
|
font_into_sleep();
|
|
font_into_sleep();
|
|
#include "EPD.h"
|
|
#include "EPD.h"
|
|
@@ -352,7 +315,7 @@ static void light_sleep_task(void *args)
|
|
f_send_get_chart_data();
|
|
f_send_get_chart_data();
|
|
// f_send_lora_rssi(Machine_info.rssi);
|
|
// f_send_lora_rssi(Machine_info.rssi);
|
|
f_send_battary_vaule(Machine_info.batt_precent);
|
|
f_send_battary_vaule(Machine_info.batt_precent);
|
|
- // f_send_get_time();
|
|
|
|
|
|
+ f_send_get_time();
|
|
}
|
|
}
|
|
|
|
|
|
if ((Machine_info.last_button.Minute != Machine_info.min) /*||(Machine_info.last_button.Hour != Machine_info.Hour)*/) //
|
|
if ((Machine_info.last_button.Minute != Machine_info.min) /*||(Machine_info.last_button.Hour != Machine_info.Hour)*/) //
|
|
@@ -461,7 +424,7 @@ 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)
|
|
|
|
|
|
+ if ((Machine_info.power_status == 1) && Machine_info.paired == 1)
|
|
{
|
|
{
|
|
is_paired_sleep = true;
|
|
is_paired_sleep = true;
|
|
ESP_LOGW(LOG_TAG, "is_paired_sleep = true");
|
|
ESP_LOGW(LOG_TAG, "is_paired_sleep = true");
|
|
@@ -476,6 +439,7 @@ static void light_sleep_task(void *args)
|
|
if (Machine_info.paired && Machine_info.power_status && !is_key_press())
|
|
if (Machine_info.paired && Machine_info.power_status && !is_key_press())
|
|
{
|
|
{
|
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
|
|
|
+ is_paired_sleep = true;
|
|
is_sleep = true; // 配对且关机,进入休眠
|
|
is_sleep = true; // 配对且关机,进入休眠
|
|
}
|
|
}
|
|
|
|
|