UIViewGroup *group=nullptr;
UIImageAnimatorView *ShutDownImageAnimatorView=nullptr;
static constexpr char *ShutDownPaths = "/user/res/RebootAndShutDown/ShutDown/"; //关机图片路径
- static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 36; // 图片帧数
+ static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30; // 图片帧数
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔
ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_X = 0;
UIViewGroup_lowpower = nullptr;
}
}
-
+ static uint8_t timer_falg_low_power=5;
void low_power_TimerCallBack(int data)
{
//uapi_poweroff_device(); // 关机
- low_power_play_toUI(3);
+ if(timer_falg_low_power)
+ {
+ timer_falg_low_power--;
+ char buf[34]={0};
+ sprintf(buf,"电量过低%ds后将自动关机",timer_falg_low_power);
+ alarm_UILabel->SetText(buf);
+ RootView::GetInstance()->Invalidate();
+ if(timer_falg_low_power==0)
+ {
+ alarm_UILabel->SetVisible(false);
+ low_power_play_toUI(3);
+ }
+
+ }
+
}
void low_power_paly(void)
{
// Set additional property
if(battery_falg==true)
{
- alarm_UILabel->SetPosition(84, 215);
- alarm_UILabel->SetText("电量过低将自动关机");
+ alarm_UILabel->SetPosition(50, 215);
+ alarm_UILabel->SetText("电量过低5s后将自动关机");
alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
alarm_UILabel->SetRollSpeed(0);
alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 33);
osStatus_t retTimer;
- low_power_timer = osTimerNew((osTimerFunc_t)low_power_TimerCallBack, osTimerOnce, NULL, NULL);
- retTimer = osTimerStart(low_power_timer, 1000*5);
+ low_power_timer = osTimerNew((osTimerFunc_t)low_power_TimerCallBack, osTimerPeriodic, NULL, NULL);
+ retTimer = osTimerStart(low_power_timer, 1000*1);
if (retTimer != osOK && low_power_timer != NULL) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer);
osTimerDelete(low_power_timer);
low_power_timer = NULL;
}
+ timer_falg_low_power=5;
+
+
}
// Add to rootView
alarm_labelbutton->SetVisible(true);
UIViewGroup_lowpower->SetTouchable(true);
alarm_labelbutton->SetTouchable(true);
+
ShowUpShutDownAnimatorView();
+ if(group)
UIViewGroup_lowpower->Add(group);
-
return UIViewGroup_lowpower;
}