|
@@ -676,10 +676,11 @@ extern uint32_t ulp_wakeup_result;
|
|
|
|
|
|
adc_oneshot_del_unit(adc1_handle); //删除adc使用
|
|
adc_oneshot_del_unit(adc1_handle); //删除adc使用
|
|
uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
|
|
uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
|
|
- printf("power on-\r\n");
|
|
|
|
|
|
+
|
|
|
|
|
|
#if 1//USER_DEEP_SLEEP_ENABLE
|
|
#if 1//USER_DEEP_SLEEP_ENABLE
|
|
reson = is_wake_up_reson(); //返回唤醒的原因
|
|
reson = is_wake_up_reson(); //返回唤醒的原因
|
|
|
|
+ ESP_LOGW(LOG_TAG,"power on- reson = %d\r\n",reson);
|
|
/* ULP Risc-V read and detected a temperature above the limit */
|
|
/* ULP Risc-V read and detected a temperature above the limit */
|
|
if (reson == ESP_SLEEP_WAKEUP_EXT0)
|
|
if (reson == ESP_SLEEP_WAKEUP_EXT0)
|
|
{
|
|
{
|
|
@@ -1124,16 +1125,17 @@ static void screen_task(void* arg)
|
|
Paint_leftScreen(Machine_info.power_status,false);
|
|
Paint_leftScreen(Machine_info.power_status,false);
|
|
Paint_rightScreen(Machine_info.power_status,false);
|
|
Paint_rightScreen(Machine_info.power_status,false);
|
|
}
|
|
}
|
|
- screen_dis_info.is_left = false;
|
|
|
|
- screen_dis_info.is_into_sleep = true;
|
|
|
|
|
|
+ Screen_dis_t screen_rev_info;
|
|
|
|
+ screen_rev_info.is_left = false;
|
|
|
|
+ screen_rev_info.is_into_sleep = true;
|
|
Machine_info.left_current_Quick_refresh_time = 1;//开机慢刷
|
|
Machine_info.left_current_Quick_refresh_time = 1;//开机慢刷
|
|
while(1)
|
|
while(1)
|
|
{
|
|
{
|
|
- if(xQueueReceive(screen_queue, &screen_dis_info,(TickType_t)portMAX_DELAY))
|
|
|
|
|
|
+ if(xQueueReceive(screen_queue, &screen_rev_info,(TickType_t)portMAX_DELAY))
|
|
{
|
|
{
|
|
font_exit_sleep();
|
|
font_exit_sleep();
|
|
- ESP_LOGI(LOG_TAG,"%s , %s",screen_dis_info.is_left?"左屏刷新":"右屏刷新",screen_dis_info.is_into_sleep?"进入睡眠":"不进睡眠");
|
|
|
|
- if(screen_dis_info.is_left)//刷左屏
|
|
|
|
|
|
+ ESP_LOGI(LOG_TAG,"%s , %s",screen_rev_info.is_left?"左屏刷新":"右屏刷新",screen_rev_info.is_into_sleep?"进入睡眠":"不进睡眠");
|
|
|
|
+ if(screen_rev_info.is_left)//刷左屏
|
|
{
|
|
{
|
|
if(Machine_info.left_current_Quick_refresh_time >= Machine_info.left_max_Quick_refresh_time)
|
|
if(Machine_info.left_current_Quick_refresh_time >= Machine_info.left_max_Quick_refresh_time)
|
|
{
|
|
{
|
|
@@ -1150,7 +1152,7 @@ static void screen_task(void* arg)
|
|
{
|
|
{
|
|
if(Machine_info.right_current_Quick_refresh_time == 0)
|
|
if(Machine_info.right_current_Quick_refresh_time == 0)
|
|
{
|
|
{
|
|
- Machine_info.left_current_Quick_refresh_time = 1;
|
|
|
|
|
|
+ Machine_info.right_current_Quick_refresh_time = 1;
|
|
Paint_rightScreen(Machine_info.power_status,true);
|
|
Paint_rightScreen(Machine_info.power_status,true);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -1159,32 +1161,32 @@ static void screen_task(void* arg)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if((Machine_info.power_status == 1)&&(Machine_info.paired == 1)&& screen_dis_info.is_into_sleep)
|
|
|
|
|
|
+ if((Machine_info.power_status == 1)&&(Machine_info.paired == 1)&& screen_rev_info.is_into_sleep)
|
|
{
|
|
{
|
|
- ESP_LOGW(LOG_TAG,"刷屏进入休眠 %s",screen_dis_info.is_left?"左屏刷新":"右屏刷新");
|
|
|
|
|
|
+ ESP_LOGW(LOG_TAG,"刷屏进入休眠 %s",screen_rev_info.is_left?"左屏刷新":"右屏刷新");
|
|
sleep_timer_start(100); //进入睡眠
|
|
sleep_timer_start(100); //进入睡眠
|
|
}
|
|
}
|
|
|
|
|
|
- if(Machine_info.power_status == 0 && screen_dis_info.is_left == false)//展示说明书都是先左后右,等右屏刷完再休眠
|
|
|
|
|
|
+ if(Machine_info.power_status == 0 )//展示说明书都是先左后右,等右屏刷完再休眠
|
|
{
|
|
{
|
|
printf("=>screen deep sleep\r\n");
|
|
printf("=>screen deep sleep\r\n");
|
|
- uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
|
|
|
|
-#if 1 //电源按键
|
|
|
|
- gpio_reset_pin(4);
|
|
|
|
- int ext_wakeup_pin_0 = 4;
|
|
|
|
- printf("Enabling EXT0 wakeup on pin GPIO%d\n", ext_wakeup_pin_0);
|
|
|
|
- ESP_ERROR_CHECK(esp_sleep_enable_ext0_wakeup(ext_wakeup_pin_0, 0));
|
|
|
|
-
|
|
|
|
- // Configure pullup/downs via RTCIO to tie wakeup pins to inactive level during deepsleep.
|
|
|
|
- // EXT0 resides in the same power domain (RTC_PERIPH) as the RTC IO pullup/downs.
|
|
|
|
- // No need to keep that power domain explicitly, unlike EXT1.
|
|
|
|
- ESP_ERROR_CHECK(rtc_gpio_pullup_en(ext_wakeup_pin_0));
|
|
|
|
- ESP_ERROR_CHECK(rtc_gpio_pulldown_dis(ext_wakeup_pin_0));
|
|
|
|
-
|
|
|
|
- esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
|
|
|
- ESP_ERROR_CHECK( esp_sleep_enable_ulp_wakeup());
|
|
|
|
-#endif
|
|
|
|
- esp_deep_sleep_start();
|
|
|
|
|
|
+// uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
|
|
|
|
+// #if 1 //电源按键
|
|
|
|
+// gpio_reset_pin(4);
|
|
|
|
+// int ext_wakeup_pin_0 = 4;
|
|
|
|
+// printf("Enabling EXT0 wakeup on pin GPIO%d\n", ext_wakeup_pin_0);
|
|
|
|
+// ESP_ERROR_CHECK(esp_sleep_enable_ext0_wakeup(ext_wakeup_pin_0, 0));
|
|
|
|
+
|
|
|
|
+// // Configure pullup/downs via RTCIO to tie wakeup pins to inactive level during deepsleep.
|
|
|
|
+// // EXT0 resides in the same power domain (RTC_PERIPH) as the RTC IO pullup/downs.
|
|
|
|
+// // No need to keep that power domain explicitly, unlike EXT1.
|
|
|
|
+// ESP_ERROR_CHECK(rtc_gpio_pullup_en(ext_wakeup_pin_0));
|
|
|
|
+// ESP_ERROR_CHECK(rtc_gpio_pulldown_dis(ext_wakeup_pin_0));
|
|
|
|
+
|
|
|
|
+// esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
|
|
|
+// ESP_ERROR_CHECK( esp_sleep_enable_ulp_wakeup());
|
|
|
|
+// #endif
|
|
|
|
+// esp_deep_sleep_start();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1412,7 +1414,14 @@ static void button_task(void* arg)
|
|
|
|
|
|
if(button_info == POWER_ON_INTO_DIS_RIGHT)
|
|
if(button_info == POWER_ON_INTO_DIS_RIGHT)
|
|
{
|
|
{
|
|
|
|
+ screen_dis_info.is_left = true;
|
|
|
|
+ if(xQueueSend(screen_queue,&screen_dis_info,portMAX_DELAY) != true)
|
|
|
|
+ {
|
|
|
|
+ ESP_LOGE(LOG_TAG,"err:screen queue send fail");
|
|
|
|
+ }
|
|
screen_dis_info.is_left = false;
|
|
screen_dis_info.is_left = false;
|
|
|
|
+ screen_dis_info.is_into_sleep = true;
|
|
|
|
+ Machine_info.left_current_Quick_refresh_time = 5;
|
|
if(xQueueSend(screen_queue,&screen_dis_info,portMAX_DELAY) != true)
|
|
if(xQueueSend(screen_queue,&screen_dis_info,portMAX_DELAY) != true)
|
|
{
|
|
{
|
|
ESP_LOGE(LOG_TAG,"err:screen queue send fail");
|
|
ESP_LOGE(LOG_TAG,"err:screen queue send fail");
|
|
@@ -1788,7 +1797,7 @@ void read_deal_data_callback_handler()
|
|
}
|
|
}
|
|
printf("\r\n");
|
|
printf("\r\n");
|
|
#endif
|
|
#endif
|
|
- ESP_LOG_BUFFER_HEX("接收的lora:",result,user_size);
|
|
|
|
|
|
+ ESP_LOG_BUFFER_HEX("接收的lora",result,user_size);
|
|
yc_data.len = user_size;
|
|
yc_data.len = user_size;
|
|
yc_data.data = malloc(sizeof(uint8_t)*user_size);//分配内存
|
|
yc_data.data = malloc(sizeof(uint8_t)*user_size);//分配内存
|
|
memcpy(yc_data.data,result,user_size);
|
|
memcpy(yc_data.data,result,user_size);
|