ソースを参照

优化蜂鸣器部分代码,优化log

wanghechen 8 ヶ月 前
コミット
ca770ff151

+ 2 - 2
components/EPD/EPD.c

@@ -1254,7 +1254,7 @@ IRAM_ATTR bool epd_cache_quick(screen_t screen,const unsigned char* old,const un
  bool ret = false;
     if((screen == SCREEN_LEFT)&&(old!=NULL))
     {
-        printf("epd_cache_quick\r\n");
+        printf("SCREEN_LEFT quick\r\n");
         //Reset the display
         gpio_set_level(PIN_L_RST, 0);
         vTaskDelay(10 / portTICK_PERIOD_MS);
@@ -1275,7 +1275,7 @@ IRAM_ATTR bool epd_cache_quick(screen_t screen,const unsigned char* old,const un
 
     if((screen == SCREEN_RIGHT)&&(old!=NULL))
     {
-        printf("right partial quick\r\n");
+        printf("SCREEN_RIGHT quick\r\n");
         gpio_set_level(PIN_R_RST, 0);
         vTaskDelay(10 / portTICK_PERIOD_MS);
         gpio_set_level(PIN_R_RST, 1);

+ 32 - 36
components/LED/LED.c

@@ -47,28 +47,9 @@ static void example_ledc_init(void)
 
 
 
-void led_init(void)
+void beep_init(void)
 {
 
-    #if 0
-    gpio_config_t led_pin_cfg = {};
-    led_pin_cfg.intr_type = GPIO_INTR_DISABLE;
-    led_pin_cfg.mode = GPIO_MODE_OUTPUT;
-    led_pin_cfg.pin_bit_mask =LED_OUTPUT_PIN_SEL;
-    led_pin_cfg.pull_down_en = 0;
-    led_pin_cfg.pull_up_en = 1;
-    gpio_config(&led_pin_cfg);
-    LED_SCLK_0;
-    LED_DATA_0;
-    LED_LCLK_0;
-    LED_RST_0;
-    LED_RST_1;
-    for(int i=0;i<6;i++)
-    led_set(i,0);
-    #else
-
-    //void app_main(void)
-{
     // Set the LEDC peripheral configuration
     example_ledc_init();
     // Set duty to 50%
@@ -77,22 +58,6 @@ void led_init(void)
     ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-    #endif
-
-}
-
 static void  _74HC595_WriteByte(unsigned char Byte)
 {
 
@@ -121,4 +86,35 @@ void led_set(uint8_t led_index,uint8_t led_status)
     {
         _74HC595_WriteByte(0x00);
     }
+}
+
+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);
+    }
+ 
 }

+ 2 - 2
components/LED/include/LED.h

@@ -49,8 +49,8 @@
 #define LED_RST_0               gpio_set_level(LED_RST_PIN, 0)
 #define LED_RST_1               gpio_set_level(LED_RST_PIN, 1)
 
-void led_init(void);
+void beep_init(void);
 void led_set(uint8_t led_index,uint8_t led_status);
 
-
+void beep_blink(uint16_t ms,uint16_t count);
 #endif/*_LED_H_*/

+ 2 - 2
components/LORA/LORA.c

@@ -2261,7 +2261,7 @@ void uart_sleep_in_config()
 void uart_sleep_out_config()
 {
 
-
+  ESP_LOGW(LOG_TAG,"uart1 sleep out");
     // gpio_reset_pin(LORA_TXD_PIN);
     // gpio_reset_pin(LORA_RXD_PIN);
 
@@ -2708,7 +2708,7 @@ int get_lora_busy_pin()
 
 void lora_set_power_level(int level)
 {
-  ESP_LOGW(LOG_TAG,"设置lora电源 %s",level?"打开":"关闭");
+  ESP_LOGW(LOG_TAG,"set lora  [%s]",level?"poweron":"poweroff");
   #if 0
     gpio_set_level(LORA_POWER_PIN,level);
   #else

+ 4 - 4
components/LORA/include/LORA.h

@@ -6,11 +6,11 @@
 
 #define ringbuffer_size     1024*60
 
-#define LORA_POWER_PIN          (20)
-#define LORA_TXD_PIN            (17)
-#define LORA_RXD_PIN            (18)
+// #define LORA_POWER_PIN          (20)
+// #define LORA_TXD_PIN            (17)
+// #define LORA_RXD_PIN            (18)
 
-#define LORA_BUSY_PIN            (5)
+// #define LORA_BUSY_PIN            (5)
 /*
 
 BUSY_STA,忙状态指示。高电平表示设备当前工作状态忙,不可进行串口操

+ 2 - 2
main/CMakeLists.txt

@@ -5,9 +5,9 @@ idf_component_register(SRCS "ulp_riscv_adc_example_main.c"
                             "yc_paint.c"
                             "esp_ble_ota.c"
                             "user_sleep.c"
-                            "wait_list.c"
+                        #     "wait_list.c"
                             "user_time.c"
-                            "batt_charge.c"
+                        #     "batt_charge.c"
                     INCLUDE_DIRS ""  "." 
                     REQUIRES soc ulp esp_adc 
 

+ 1 - 1
main/ulp_riscv_adc_example_main.c

@@ -51,7 +51,7 @@
 #include "iot_button.h"
 
 static const char *LOG_TAG = "ulp_riscv_adc";
-extern  uint8_t _wakeup_reson;  //内存上次唤醒的原因
+// extern  uint8_t _wakeup_reson;  //内存上次唤醒的原因
 extern QueueHandle_t screen_queue;
 bool is_first_run = false;      //当前时间片只执行一次标志
 

+ 1 - 1
main/user_sleep.h

@@ -28,7 +28,7 @@ void user_sleep_into();
 #include "esp_err.h"
 esp_err_t example_register_timer_wakeup(void);
 
-extern  uint8_t _wakeup_reson;  //内存上次唤醒的原因
+// extern  uint8_t _wakeup_reson;  //内存上次唤醒的原因
 
 int is_wake_up_reson();  //返回唤醒的原因
 

+ 8 - 20
main/yc_protocol.c

@@ -136,9 +136,8 @@ void reset_default(bool is_dis,uint8_t power_status)
 void  print_systenInfo(void)
 {
     printf("=================================\r\n");
-    printf("=================================\r\n");
     printf("=======%s======\r\n","2024.1.4 [11时] burn");//打印烧录时间
-    printf("=================================\r\n");
+    printf("=============%s===========\r\n",__TIME__);
     printf("=================================\r\n");
     printf("========version V %d.%d.%d==========\r\n",VERSION_X,VERSION_Y,VERSION_Z);
     esp_efuse_mac_get_default((uint8_t*)mac_addr);
@@ -235,7 +234,7 @@ void screen_display(void)
             pdTRUE,
             pdFALSE,
             0);
-    ESP_LOGE(LOG_TAG,"xEventGroupWaitBits bits = %ld",bits);
+    ESP_LOGW(LOG_TAG,"xEventGroupWaitBits bits = %ld",bits);
     /* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually
      * happened. */
     if(bits == 3){
@@ -272,7 +271,7 @@ void screen_display(void)
             ESP_LOGE(LOG_TAG,"err:screen queue send fail");
         }
     } else {
-        ESP_LOGE(LOG_TAG, "UNEXPECTED EVENT");
+        ESP_LOGI(LOG_TAG, "UNEXPECTED EVENT");
     }
 }
 
@@ -1572,7 +1571,7 @@ static void hardware_ack_delete_msg_id(const LORA_DATA_T* buf)
     int msg_id = ( buf->data_buf[11]>>8)| buf->data_buf[12];  //获取当前消息id 用于删除当前链表的数据
     ESP_LOG_BUFFER_HEX("ACK",buf->data_buf,buf->data_len);
 
-    int current =  countNodes(Send_list);   //获取当前节点数据
+    // int current =  countNodes(Send_list);   //获取当前节点数据
     Node *find  = findNode(Send_list,msg_id);
     printf("delete list node bofore = %d\r\n",msg_id);
 
@@ -1603,7 +1602,7 @@ void business_logic_func(const LORA_DATA_T* buf,uint8_t cmd_index,int msg)
 {
     int cmd = 0;    //当前的命令
     int msg_id = 0; //消息的id
-    bool is_rsp_ack = false;
+    // bool is_rsp_ack = false;
     #if 0
     printf("cmd = %02X\r\n",buf->data_buf[cmd_index]);
     #endif
@@ -1774,8 +1773,7 @@ void uincode2gbk(char *str,uint16_t len,char *out_buffer)
     unsigned int  iunicode,i;
     unsigned int  igbk;
     memset(strtmp,0,1024);
-    char* p_text = str;
-     int index = 0;
+    int index = 0;
 
    i=0;
 
@@ -2458,9 +2456,8 @@ void f_send_get_chart_data(void)
 {
 
    uint8_t strlorabuf[200];
-   uint8_t  strnum[20];
 
-   static int rssiold=0;
+
    int crc16=0,i=0,len=0;
 
   strlorabuf[0]=0x5A;
@@ -2504,9 +2501,7 @@ void f_send_version(void)
     
     ESP_LOGW(LOG_TAG,"f_send_version");
     uint8_t strlorabuf[200];
-    uint8_t  strnum[20];
 
-    static int rssiold=0;
     int crc16=0,i=0,len=0;
 
     strlorabuf[0]=0x5A;
@@ -2552,9 +2547,7 @@ void f_send_lora_rssi(int rssi)
     
     // ESP_LOGW(LOG_TAG,"f_send_lora_rssi:rssi = %d",rssi);
     uint8_t strlorabuf[200];
-    uint8_t  strnum[20];
 
-    static int rssiold=0;
     int crc16=0,i=0,len=0;
 
     strlorabuf[0]=0x5A;
@@ -2600,9 +2593,7 @@ void f_send_battary_vaule(int battry)
 {
 
    uint8_t strlorabuf[200];
-   uint8_t  strnum[20];
 
-   static int rssiold=0;
    int crc16=0,i=0,len=0;
 
   strlorabuf[0]=0x5A;
@@ -2651,9 +2642,7 @@ void f_send_reply_status(int status)
 {
 
    uint8_t strlorabuf[200];
-   uint8_t  strnum[20];
 
-   static int rssiold=0;
    int crc16=0,i=0,len=0;
 
   strlorabuf[0]=0x5A;
@@ -3014,7 +3003,6 @@ void send_update_status(void)
 
 uint8_t strlorabuf[200];
 
-uint8_t  strnum[20];
 
   int crc16=0,i=0,len=0;
 
@@ -3448,7 +3436,7 @@ void selectionSort(int arr[], int n, int indices[]) {
 
 int  person_get_num_is_exist(uint8_t type,uint16_t num)
 {
-     uint8_t  index = 0;
+    //  uint8_t  index = 0;
  
     // printf("person_get_num_is_exist %d\r\n",num);
 

+ 29 - 204
main/yc_terminal.c

@@ -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)  //开机状态
                         {