float voltage = 0.0F;
uint8_t value = 0;
value = battery_get_voltage(&voltage);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "battery_get_voltage = %d",value);
// 更新电池信息
- const char *progressImages[3] = {
- "/user/res/Battery/Battery_Limit.bin", // 低电量图片路径
- "/user/res/Battery/Battery_Save.bin", // 中等电量图片路径
- "/user/res/Battery/Battery_Normal.bin" // 正常电量图片路径
- };
- const char *progressImageSrc = nullptr;
- for (int i = 0; i < 3; i++)
- {
- if (value <= (i + 1) * 10)
- {
- progressImageSrc = progressImages[i];
- // PRINT("Update progressImageSrc!\n");
- break;
- }
- }
+ // const char *progressImages[3] = {
+ // "/user/res/Battery/Battery_Limit.bin", // 低电量图片路径
+ // "/user/res/Battery/Battery_Save.bin", // 中等电量图片路径
+ // "/user/res/Battery/Battery_Normal.bin" // 正常电量图片路径
+ // };
+ // const char *progressImageSrc = nullptr;
+ // for (int i = 0; i < 3; i++)
+ // {
+ // if (value <= (i + 1) * 10)
+ // {
+ // progressImageSrc = progressImages[i];
+ // // PRINT("Update progressImageSrc!\n");
+ // break;
+ // }
+ // }
if (PullUpDownView::GetInstance() != nullptr)
{
- PullUpDownView::GetInstance()->GetProgress()->SetImage(progressImageSrc, progressImageSrc);
+ // PullUpDownView::GetInstance()->GetProgress()->SetImage(progressImageSrc, progressImageSrc);
PullUpDownView::GetInstance()->GetProgress()->SetValue(value);
PullUpDownView::GetInstance()->GetDateLabel()->SetText(dateStr);
PullUpDownView::GetInstance()->GetTimeLabel()->SetText(timeStr);
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-26 18:14:24
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-31 15:30:14
+ * @LastEditTime: 2024-07-31 20:53:09
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp
*/
progress->SetPosition(206, 180, PROGRESS_WIDTH, PROGRESS_HEIGHT);
progress->SetValidHeight(PROGRESS_HEIGHT);
progress->SetValidWidth(PROGRESS_WIDTH);
-
- // progress->SetValue(value);
- const char *progressImageSrc = "/user/res/Battery/Battery_Normal.bin";
- progress->SetImage(progressImageSrc, progressImageSrc);
+ progress->SetValue(20);
+ // progress->SetRange(100,0);
+ // const char *progressImageSrc = "/user/res/Battery/Battery_Normal.bin";
+ // progress->SetImage(progressImageSrc, progressImageSrc);
progress->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0x00);
progress->SetBackgroundStyle(STYLE_TEXT_COLOR, 0xff000000);
progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);