Sfoglia il codice sorgente

修改关机逻辑

wanghechen 8 mesi fa
parent
commit
63a513155d

+ 4 - 4
components/Decection/Decection.c

@@ -16,9 +16,9 @@ const static char *TAG = "Decection";
 static int adc_raw[2][10];
 static int voltage[2][10];
 // 0度的电池电量映射
-batt_map batt_map_0Du[] = {
+batt_map batt_map_0Du[100] = {
     //
-    {2225, 100},
+    {2200, 100},
     {2162, 99},
     {2156, 98},
     {2151, 97},
@@ -134,7 +134,7 @@ adc_cali_handle_t adc2_cali_handle = NULL;
 // }
 static int get_batt_pre(int vol)
 {
-    for (int i = 0; i <= 100; i++)
+    for (int i = 0; i < 100; i++)
     {
         if (vol >= batt_map_0Du[i].vol)
         {
@@ -169,7 +169,7 @@ int adc_read_power_pin(adc_oneshot_unit_handle_t adc_handle)
         ESP_LOGD(TAG, "ADC%d Channel[%d] Cali Voltage: %d mV", USER_ADC_UNIT + 1, USER_ADC_CHANNEL, voltage[0][0]);
         adc_calibration_deinit(adc2_cali_handle);
     }
-    
+
     return get_batt_pre(voltage[0][0]);
 }
 

+ 7 - 3
main/ulp_riscv_adc_example_main.c

@@ -461,9 +461,13 @@ static void light_sleep_task(void *args)
             if (read_battery_voltage() == 0)
             {
                 ESP_LOGE(LOG_TAG, "-->low batt!!!! , power off\r\n");
-#if 0
-                set_screen_dis_info_and_send_queue(false, false, false, false,100);
-                set_screen_dis_info_and_send_queue(true, false, true, false,100);
+#if 1
+                if (Machine_info.paired == 1)
+                {
+                    is_paired_sleep = true;
+                }
+                set_screen_dis_info_and_send_queue(false, true, true, false, 500);
+                set_screen_dis_info_and_send_queue(true, false, false, false, 500);
 #endif
             }
 

+ 3 - 3
main/yc_terminal.c

@@ -515,10 +515,10 @@ lora_receiveQueue = xQueueCreate(100, sizeof(int));
             if (0 == gpio_get_level(4))
             {
 
-                if (read_battery_voltage() < 10) // 判断电压小于10% 不让开机
+                if (read_battery_voltage() <= 1) // 判断电压小于0% 不让开机
                 {
 
-                    printf("start power off// 判断电压小于10 不让开机\r\n");
+                    printf("start power off// 判断电压小于1 不让开机\r\n");
                     uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
 
 #if 1 // 电源按键
@@ -836,7 +836,7 @@ static void screen_task(void *arg)
             if (Machine_info.power_status == 0) // 展示说明书都是先左后右,等右屏刷完再休眠
             {
                 ESP_LOGW(LOG_TAG, "now is power off");
-                sleep_timer_start(1000); // 进入睡眠
+                sleep_timer_start(500); // 进入睡眠
             }
             // ESP_LOGW(LOG_TAG, "screen task over");
         }