فهرست منبع

2024.1.12给艾总版本

wanghechen 8 ماه پیش
والد
کامیت
9383e7c318
5فایلهای تغییر یافته به همراه17 افزوده شده و 56 حذف شده
  1. 9 9
      components/button/user_button.c
  2. 6 42
      main/ulp_riscv_adc_example_main.c
  3. 1 1
      main/user_sleep.h
  4. 1 1
      main/yc_protocol.c
  5. 0 3
      main/yc_terminal.c

+ 9 - 9
components/button/user_button.c

@@ -190,7 +190,7 @@ void button_init(adc_oneshot_unit_handle_t adc_handle)
             printf("Button create failed");
         }
         button_idx = i;
-        iot_button_register_cb( user_button_handle[i], BUTTON_PRESS_DOWN, button_down_cb,button_idx);
+        iot_button_register_cb(user_button_handle[i], BUTTON_PRESS_DOWN, button_down_cb, button_idx);
         iot_button_register_cb(user_button_handle[i], BUTTON_PRESS_UP, user_button_up_cb, button_idx); // 松手才发按键消息
 
         // iot_button_register_cb( user_button_handle[i], BUTTON_LONG_PRESS_UP, long_press_up_cb,button_idx);
@@ -455,18 +455,18 @@ static void power_single_press_cb(void *arg, void *usr_data)
     switch ((int)usr_data)
     {
     case 0:
-        ESP_LOGW(LOG_TAG,"power sigle press\r\n");
+        ESP_LOGW(LOG_TAG, "power sigle press\r\n");
 
         // if (Machine_info.power_status == 1) // 开机
         // {
 
-            button_info = POWER_ON_PRESS_VALUE;
+        button_info = POWER_ON_PRESS_VALUE;
 
-            if (xQueueSend(button_Data_queue, &button_info, 0) != true)
-            {
-                ESP_LOGE(LOG_TAG, "queue send is fail");
-                return;
-            }
+        if (xQueueSend(button_Data_queue, &button_info, 0) != true)
+        {
+            ESP_LOGE(LOG_TAG, "queue send is fail");
+            return;
+        }
         // }
         // else
         // {
@@ -493,7 +493,7 @@ static void power_single_press_cb(void *arg, void *usr_data)
 }
 static void button_down_cb(void *arg, void *usr_data)
 {
-    ESP_LOGI(LOG_TAG, "%d true",(int)usr_data);
+    ESP_LOGI(LOG_TAG, "%d true", (int)usr_data);
     is_down = true;
 }
 static void user_button_up_cb(void *arg, void *usr_data)

+ 6 - 42
main/ulp_riscv_adc_example_main.c

@@ -103,20 +103,14 @@ static void light_sleep_task(void *args)
         extern bool is_sleep;
         if (is_sleep == true)
         {
-            lora_set_power_level(0);
+            // lora_set_power_level(0);
 #if USER_LIGHT_SLEEP_ENABLE
-
             // ESP_LOGE(LOG_TAG, "start light_sleep ,is_first_run = %d\r\n", is_first_run);
 
             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();
 #include "EPD.h"
                 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_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 // 电源按键
 
                 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) // 开机状态且配对
             {
+                lora_set_power_level(0);
                 is_paired_sleep = false; // 只有发送完lora消息后才会进入休眠
                 font_into_sleep();
 #include "EPD.h"
@@ -352,7 +315,7 @@ static void light_sleep_task(void *args)
                     f_send_get_chart_data();
                     // f_send_lora_rssi(Machine_info.rssi);
                     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)*/) //
@@ -461,7 +424,7 @@ static void light_sleep_task(void *args)
             break;
         case ESP_SLEEP_WAKEUP_ULP:
             iot_button_resume();
-            if (Machine_info.paired == 1)
+            if ((Machine_info.power_status == 1) && Machine_info.paired == 1)
             {
                 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())
             {
                 vTaskDelay(2000 / portTICK_PERIOD_MS);
+                is_paired_sleep = true;
                 is_sleep = true; // 配对且关机,进入休眠
             }
 

+ 1 - 1
main/user_sleep.h

@@ -1,7 +1,7 @@
 #ifndef __USER_SLEEP_H__
 #define __USER_SLEEP_H__
 
-#define TIMER_WAKEUP_TIME_S 6
+#define TIMER_WAKEUP_TIME_S 30
 #define TIMER_WAKEUP_TIME_US (TIMER_WAKEUP_TIME_S * 1000 * 1000) // 定义的唤醒的时间
 #define TIMER_CAN_SEND_TIME (200)                                // 定义可以唤醒lora工作的时间单位ms
 #define LORA_POWER_TIME (2000)

+ 1 - 1
main/yc_protocol.c

@@ -114,7 +114,7 @@ void reset_default(bool is_dis, uint8_t power_status)
  */
 void print_systenInfo(void)
 {
-    printf("=================================\r\n");
+    printf("============OTA2=====================\r\n");
     printf("=======%s======\r\n", "2024.1.9 [18时] burn"); // 打印烧录时间
     printf("=============%s===========\r\n", __TIME__);
     printf("=================================\r\n");

+ 0 - 3
main/yc_terminal.c

@@ -899,9 +899,6 @@ static void screen_task(void *arg)
             if ((Machine_info.power_status == 1) /*&& (Machine_info.paired == 1) */ && screen_rev_info.is_into_sleep)
             {
                 ESP_LOGW(LOG_TAG, "%dms sleep  %s", screen_rev_info.sleep_ms, screen_rev_info.is_left ? "left" : "right");
-                // if (screen_rev_info.sleep_ms == 1)
-                //     sleep_timer_start(100); // 进入睡眠
-                // else
                 sleep_timer_start(screen_rev_info.sleep_ms); // 进入睡眠
             }