From 0ed2e1ba3ea258fbdd1e500484887e2a90a2faa9 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Thu, 21 Dec 2023 11:08:06 +0800 Subject: [PATCH] =?utf8?q?=E8=A1=A8=E7=9B=98=E7=A7=92=E9=92=88=E8=AE=BE?= =?utf8?q?=E7=BD=AE=E6=9B=B4=E6=96=B020=E5=B8=A7/=E7=A7=92=EF=BC=8C?= =?utf8?q?=E7=94=B5=E6=B1=A0=E7=94=B5=E9=87=8F10=E7=A7=92=E6=9B=B4?= =?utf8?q?=E6=96=B0=E4=B8=80=E6=AC=A1=E3=80=82=E5=B9=B6=E4=B8=94xts?= =?utf8?q?=E6=B5=8B=E8=AF=95=E6=9C=9F=E9=97=B4=EF=BC=8C=E4=B8=8D=E8=BF=9B?= =?utf8?q?=E8=A1=8C=E7=94=B5=E6=B1=A0=E7=94=B5=E9=87=8F=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/clock/include/MainClockView.h | 35 ++++++++++++++++++- .../nativeui/clock/src/MainClockView.cpp | 4 +-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h b/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h index 43d443c8d..a6769495b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h @@ -38,7 +38,24 @@ #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) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp index a404062be..fba57b395 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp @@ -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); -- 2.17.1