表盘秒针设置更新20帧/秒,电池电量10秒更新一次。并且xts测试期间,不进行电池电量检测
authorSnickerSun <snickersun@163.com>
Thu, 21 Dec 2023 03:08:06 +0000 (11:08 +0800)
committerSnickerSun <snickersun@163.com>
Thu, 21 Dec 2023 03:08:06 +0000 (11:08 +0800)
code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h
code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp

index 43d443c..a676949 100755 (executable)
 #include "components/ui_label.h"
 #include "battery.h"
 
+#include "hal_tick.h"
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C" {
+#endif
+#endif
+
 extern uint8_t battery_get_voltage(float *voltage);
+#ifdef XTS_SUPPORT
+extern uint8_t is_xts_test_done(void);
+#endif
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif
+#endif
+
 namespace OHOS {
 static constexpr int16_t SEC_TO_MILLI = 1000;
 static constexpr int16_t USEC_TO_MILLI = 1000;
@@ -69,6 +86,7 @@ public:
 private:
     UISweepClock *sweepClock{nullptr};
 };
+
 class ProgressCallback : public AnimatorCallback {
 public:
     explicit ProgressCallback(UIBoxProgress *progress, UILabel *label) : progress(progress), label(label) {}
@@ -78,7 +96,22 @@ public:
         //int value = std::rand() % 101; // 生成一个介于 0 和 100 之间的随机数
         float voltage = 0.0F ;
         // battery_get_voltage_by_channel(&voltage,channel);
-        uint8_t value = battery_get_voltage(&voltage);
+        uint8_t value = 0 ;
+        uint8_t xts_testing = 0 ;
+       
+        uint32_t RunTime_ = HALTick::GetInstance().GetTime();
+       
+        #ifdef XTS_SUPPORT
+        xts_testing = is_xts_test_done();
+        #endif
+        if(xts_testing){
+            value = 0;
+            printf("bat check stamp %u xts_testing %u\r\n",RunTime_,xts_testing);
+            return ;
+        }else{
+            value = battery_get_voltage(&voltage);
+            printf("bat check stamp %u xts_testing %u\r\n",RunTime_,xts_testing);
+        }
         char* progress1ForeImageSrc = nullptr;
         char* progress1BackImageSrc = nullptr;
         if (value <= 10) {
index a404062..fba57b3 100755 (executable)
@@ -564,13 +564,13 @@ bool MainClockView::InitView(void)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "callBack new fail");
         return false;
     }
-    clockAnimator = new Animator(callBack, mainSweepClock, 0, true);
+    clockAnimator = new Animator(callBack, mainSweepClock, 50, true);
     if (clockAnimator == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clockAnimator new fail");
         return false;
     }
     progress1callback_ = new ProgressCallback(progress,batteryLabel);
-    progress1animator_ = new Animator(progress1callback_,progress,5000,true);
+    progress1animator_ = new Animator(progress1callback_,progress,10000,true);
     progress1animator_->Start();
     clockAnimator->Start();
     SetCoverable(true);