From: SnickerSun Date: Thu, 21 Dec 2023 03:08:06 +0000 (+0800) Subject: 表盘秒针设置更新20帧/秒,电池电量10秒更新一次。并且xts测试期间,不进行电池电量检测 X-Git-Tag: release_V1.2.70_20241020_135402~1379 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=0ed2e1ba3ea258fbdd1e500484887e2a90a2faa9;p=mirrors%2FFD230.git 表盘秒针设置更新20帧/秒,电池电量10秒更新一次。并且xts测试期间,不进行电池电量检测 --- 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);