From: Caisking Date: Thu, 10 Jul 2025 06:59:45 +0000 (+0800) Subject: 修复自定义表盘电量相关组件消失的bug X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=354c828dba1f4ce89f65addd459b312f14c5fb26;p=mirrors%2FFD230.git 修复自定义表盘电量相关组件消失的bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/clock/include/MainClockView.h b/code/sdk/application/wearable/fd230app/nativeui/clock/include/MainClockView.h index eaebfa27b..dccf3b9f7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/clock/include/MainClockView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/clock/include/MainClockView.h @@ -167,7 +167,7 @@ namespace OHOS BatteryDisplayType batterySetting = BATTERY_DISPLAY_NONE; // 电池设置 TimeDisplayPosition timePosition = TIME_DISPLAY_DEFAULT; // 时间位置 int64_t color_ = Color::White().full; // 电量颜色 - int32_t power_ = 100; // 电量 + int32_t power_ = 101; // 电量 bool isBatteryIconVisible{false}; // 电池暂停 }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp b/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp index 9a67851ce..6f374d4c6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp @@ -189,6 +189,11 @@ namespace OHOS timePosition = static_cast(dialconfig.timeDisplay); batterySetting = static_cast(dialconfig.batteryDisplay); colorType = static_cast(dialconfig.colorTypeSet); + + //打印表盘配置 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timePosition is %d", timePosition); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batterySetting is %d", batterySetting); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "colorType is %d", colorType); } else { @@ -627,8 +632,13 @@ namespace OHOS float voltage = 0.0F; int power = battery_get_voltage(&voltage); - if (power == power_) - return; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "batteryprogress power_:%d power:%d", power_,power); + if (power == power_) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"power is not"); + return; + } + power_ = power; // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryprogress power_:%d", power_);