|
@@ -13,7 +13,6 @@
|
|
|
|
|
|
#include "user_config.h"
|
|
|
|
|
|
-//#include "lvgl/lvgl.h"
|
|
|
#include"LED.h"
|
|
|
#include"list.h"
|
|
|
#include "freertos/timers.h"
|
|
@@ -21,9 +20,7 @@
|
|
|
#include "user_sleep.h"
|
|
|
#include "esp_sleep.h"
|
|
|
#include "esp_sleep.h"
|
|
|
-//#include "ble_ota.h"
|
|
|
|
|
|
-#include "batt_charge.h"
|
|
|
#include "user_time.h"
|
|
|
#include "driver/uart.h"
|
|
|
#include "driver/rtc_io.h"
|
|
@@ -105,41 +102,8 @@ void uart_task_callback_handler();
|
|
|
|
|
|
|
|
|
|
|
|
-void beep_open()
|
|
|
-{
|
|
|
-
|
|
|
- // Set duty to 50%
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, LEDC_DUTY));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
|
|
|
-void beep_close()
|
|
|
-{
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-void beep_blink(uint16_t ms,uint16_t count)
|
|
|
-{
|
|
|
-
|
|
|
- for(int i =0;i<count;i++)
|
|
|
- {
|
|
|
- //printf("beep\r\n");
|
|
|
- beep_open();
|
|
|
- vTaskDelay(ms / portTICK_PERIOD_MS);
|
|
|
- beep_close();
|
|
|
- vTaskDelay(ms / portTICK_PERIOD_MS);
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
@@ -342,7 +306,7 @@ void app_init()
|
|
|
#endif
|
|
|
//设置蜂鸣器声音
|
|
|
#if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
|
|
|
- led_init();
|
|
|
+ beep_init();
|
|
|
#endif
|
|
|
|
|
|
|
|
@@ -688,16 +652,9 @@ extern uint32_t ulp_wakeup_result;
|
|
|
{
|
|
|
Machine_info.power_status = 1; //开机
|
|
|
lora_set_power_level(1); //打开lora电源
|
|
|
- // Set duty to 50%
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, LEDC_DUTY));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
-
|
|
|
- vTaskDelay(1000/ portTICK_PERIOD_MS);
|
|
|
-
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
+ //恢复串口i功能
|
|
|
+ uart_sleep_out_config();
|
|
|
+ beep_blink(1000,1);
|
|
|
|
|
|
Machine_info.left_current_Quick_refresh_time = 5;
|
|
|
vTaskDelay(1000/ portTICK_PERIOD_MS);
|
|
@@ -848,14 +805,7 @@ extern uint32_t ulp_wakeup_result;
|
|
|
ESP_LOGE(LOG_TAG,"btn = %d",btn);
|
|
|
Machine_info.left_state = btn;
|
|
|
|
|
|
- // Set duty to 50%
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, LEDC_DUTY));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
- vTaskDelay(30 / portTICK_PERIOD_MS);
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
+ beep_blink(30,1);
|
|
|
|
|
|
|
|
|
|
|
@@ -1001,109 +951,6 @@ print_systenInfo();
|
|
|
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-// static void board_init(void)
|
|
|
-// {
|
|
|
-
|
|
|
-// #if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
|
|
|
-// led_init();
|
|
|
-// #endif
|
|
|
-
|
|
|
-
|
|
|
-// #if USER_DEEP_SLEEP_ENABLE
|
|
|
-// int reson = is_wake_up_reson(); //返回唤醒的原因
|
|
|
-// /* ULP Risc-V read and detected a temperature above the limit */
|
|
|
-// if (reson == ESP_SLEEP_WAKEUP_ULP)
|
|
|
-// {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// // Set duty to 50%
|
|
|
-// ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, LEDC_DUTY));
|
|
|
-// // Update duty to apply the new value
|
|
|
-// ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
-
|
|
|
-// vTaskDelay(30 / portTICK_PERIOD_MS);
|
|
|
-
|
|
|
-// ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
|
|
-// // Update duty to apply the new value
|
|
|
-// ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
-// }
|
|
|
-// #endif
|
|
|
-
|
|
|
-// #if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
|
|
|
-// font_init();
|
|
|
-// #endif
|
|
|
-
|
|
|
-// #if HARDWARE_SPI
|
|
|
-
|
|
|
-
|
|
|
-// #if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
|
|
|
-// epd_init();
|
|
|
-// #endif
|
|
|
-
|
|
|
-// #else
|
|
|
-// left_screen.epd_name = "left_screen";
|
|
|
-// left_screen.busy_pin = 42;
|
|
|
-// left_screen.res_pin = 41;
|
|
|
-// left_screen.dc_pin = 40;
|
|
|
-// left_screen.cs_pin = 39;
|
|
|
-// left_screen.sclk_pin = 48;
|
|
|
-// left_screen.sda_pin = 45;
|
|
|
-// epd_screen_init(&left_screen);
|
|
|
-
|
|
|
-// right_screen.epd_name = "right_screen";
|
|
|
-// right_screen.busy_pin = 13;
|
|
|
-// right_screen.res_pin = 14;
|
|
|
-// right_screen.dc_pin = 21;
|
|
|
-// right_screen.cs_pin = 47;
|
|
|
-// right_screen.sclk_pin = 48;
|
|
|
-// right_screen.sda_pin = 45;
|
|
|
-
|
|
|
-// epd_screen_init(&right_screen);
|
|
|
-// #endif
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// #if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
|
|
|
-// timer_init();
|
|
|
-// #endif
|
|
|
-
|
|
|
-
|
|
|
-// #if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
|
|
|
-// //adc1_init();
|
|
|
-// #endif
|
|
|
-
|
|
|
-// //adc_read_power_pin();
|
|
|
-// //ESP_LOGI(LOG_TAG,"board_init");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// #if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
|
|
|
-// button_init(adc1_handle);
|
|
|
-// #endif
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// #if USER_NOT_SLEEP_ENABLE || USER_LIGHT_SLEEP_ENABLE || USER_DEEP_SLEEP_ENABLE
|
|
|
-// lora_init();
|
|
|
-// #endif
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
static void screen_task(void* arg)
|
|
|
{
|
|
|
Machine_info.rssi = 100;//没有获取到真数据,默认100
|
|
@@ -1167,27 +1014,27 @@ static void screen_task(void* arg)
|
|
|
sleep_timer_start(100); //进入睡眠
|
|
|
}
|
|
|
|
|
|
- if(Machine_info.power_status == 0 )//展示说明书都是先左后右,等右屏刷完再休眠
|
|
|
- {
|
|
|
- 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();
|
|
|
- }
|
|
|
+// if(Machine_info.power_status == 0 )//展示说明书都是先左后右,等右屏刷完再休眠
|
|
|
+// {
|
|
|
+// 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();
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1309,15 +1156,8 @@ static void button_task(void* arg)
|
|
|
ESP_LOGE(LOG_TAG,"err:screen queue send fail");
|
|
|
}
|
|
|
#endif
|
|
|
- // Set duty to 50%
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, LEDC_DUTY));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
- vTaskDelay(30 / portTICK_PERIOD_MS);
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
|
|
|
+ beep_blink(30,1);
|
|
|
|
|
|
//printList(Send_list);
|
|
|
//printList(list_head);
|
|
@@ -1332,16 +1172,9 @@ static void button_task(void* arg)
|
|
|
|
|
|
if(button_info == POWER_ON_PRESS_VALUE) //power 开机时短按
|
|
|
{
|
|
|
- // Set duty to 50%
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, LEDC_DUTY));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
|
|
|
- vTaskDelay(30 / portTICK_PERIOD_MS);
|
|
|
+ beep_blink(30,1);
|
|
|
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
|
|
|
|
|
|
if( (Machine_info.power_status == 1) && (Machine_info.paired == 1))
|
|
@@ -1360,17 +1193,9 @@ static void button_task(void* arg)
|
|
|
|
|
|
if(button_info == POWER_ON_INTO_STATUS_CHANGE_VALUE) //power 长按触发
|
|
|
{
|
|
|
- // Set duty to 50%
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, LEDC_DUTY));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
-
|
|
|
- vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
|
|
|
|
+ beep_blink(1000,1);
|
|
|
|
|
|
- ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
|
|
|
- // Update duty to apply the new value
|
|
|
- ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
|
|
|
|
|
if(Machine_info.power_status == 1) //开机状态
|
|
|
{
|