二维码界面电量更新改成5s一只刷新 3312/1 3312/head
authorluozheng <1732036298@qq.com>
Thu, 26 Mar 2026 08:48:52 +0000 (16:48 +0800)
committerluozheng <1732036298@qq.com>
Thu, 26 Mar 2026 08:48:52 +0000 (16:48 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/watchQRcode/include/WatchQRCodeView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/watchQRcode/src/WatchQRCodeView.cpp

index da9ad81..4aff788 100644 (file)
@@ -29,7 +29,7 @@ namespace OHOS
         static uint8_t refresh_time;
         std::string get_voltage_and_version_string(void);
         void update_label(void);
-        void start_refresh_timer(uint32_t interval = 2000);
+        void start_refresh_timer(uint32_t interval = 5000);
         void stop_refresh_timer(void);
         /* -------------------------------------------------------------------------- */
 
index 485b935..f2299c7 100644 (file)
@@ -214,9 +214,9 @@ namespace OHOS
     /*定时器到期时的处理*/
     static void QRCodeView_TimerCallbackProc(int data)
     {
-        if (uapi_get_screen_state() == 0) // 如果在亮屏状态
+        // if (uapi_get_screen_state() == 0) // 如果在亮屏状态
         {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "uapi_get_screen_state() == 0");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_get_screen_state() == 0");
             if (WatchQRCodeView::GetInstance())
             {
                 WatchQRCodeView::GetInstance()->update_label();
@@ -226,26 +226,26 @@ namespace OHOS
                 WatchQRCodeView::refresh_time = UPDATETIME_OUT;
             }
         }
-        else
-        {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "uapi_get_screen_state() == 1");
-            WatchQRCodeView::refresh_time -= 2;
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "%d", WatchQRCodeView::refresh_time);
-            if (WatchQRCodeView::refresh_time <= 0) // 息屏状态下超时删除定时器
-            {
-                if (WatchQRCodeView::GetInstance())
-                {
-                    GraphicService::GetInstance()->PostGraphicEvent(std::bind(&WatchQRCodeView::stop_refresh_timer, WatchQRCodeView::GetInstance()));
-                }
-            }
-            else
-            {
-                if (WatchQRCodeView::GetInstance())
-                {
-                    WatchQRCodeView::GetInstance()->update_label();
-                }
-            }
-        }
+        // else
+        // {
+        //     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "uapi_get_screen_state() == 1");
+        //     WatchQRCodeView::refresh_time -= 2;
+        //     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "%d", WatchQRCodeView::refresh_time);
+        //     if (WatchQRCodeView::refresh_time <= 0) // 息屏状态下超时删除定时器
+        //     {
+        //         if (WatchQRCodeView::GetInstance())
+        //         {
+        //             GraphicService::GetInstance()->PostGraphicEvent(std::bind(&WatchQRCodeView::stop_refresh_timer, WatchQRCodeView::GetInstance()));
+        //         }
+        //     }
+        //     else
+        //     {
+        //         if (WatchQRCodeView::GetInstance())
+        //         {
+        //             WatchQRCodeView::GetInstance()->update_label();
+        //         }
+        //     }
+        // }
         return;
     }