低电关机画面弹出逻辑
This commit is contained in:
parent
46d348cf5e
commit
d0b78b4a8b
|
@ -483,7 +483,14 @@ INT32 System_OnShutdown(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray)
|
|||
if(sf_get_mode_flag() && SHOW_POWER_OFF == displayShow)
|
||||
#endif
|
||||
{
|
||||
if (FALSE == isMenu)
|
||||
if (!sf_cardv_battery_level_get())
|
||||
{
|
||||
Display_ShowSplash(SPLASH_POWEROFF);
|
||||
SwTimer_DelayMs(500);
|
||||
GxDisplay_Set(LAYER_OSD1, LAYER_STATE_ENABLE, 0); //turn off OSD1
|
||||
GxDisplay_Flush(LAYER_OSD1);
|
||||
}
|
||||
else if (FALSE == isMenu)
|
||||
{
|
||||
GxDisplay_Set(LAYER_OSD1, LAYER_STATE_ENABLE, 0); //turn off OSD1
|
||||
GxDisplay_Flush(LAYER_OSD1);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#define UPDATE_TIMEER_MS 200
|
||||
#define LOW_BATTERY_TIMEER_MS 500
|
||||
static lv_task_t* update_timer = NULL;
|
||||
static lv_group_t* gp = NULL;
|
||||
static DISPLAY_FINAL_E gPowerOff = DISPLAY_FINAL_END;
|
||||
|
@ -26,30 +27,60 @@ static void task_update_timer_cb(lv_task_t* task)
|
|||
{
|
||||
static short closing_index = 0;
|
||||
static unsigned int time_ms = 3 * 1000;
|
||||
lv_plugin_res_id res[] = {
|
||||
if (DISPLAY_FINAL_LOW_BATTERY == gPowerOff)
|
||||
{
|
||||
time_ms -= LOW_BATTERY_TIMEER_MS;
|
||||
closing_index ++;
|
||||
if (time_ms == 0)
|
||||
{
|
||||
printf("task_update_timer_cb gPowerOff = %d\n", gPowerOff);
|
||||
Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, APP_POWER_OFF_BATT_EMPTY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_plugin_res_id res[] = {
|
||||
LV_PLUGIN_IMG_ID_SF_BUSY_1,
|
||||
LV_PLUGIN_IMG_ID_SF_BUSY_2,
|
||||
LV_PLUGIN_IMG_ID_SF_BUSY_3,
|
||||
LV_PLUGIN_IMG_ID_SF_BUSY_4
|
||||
};
|
||||
closing_index = closing_index % 4;
|
||||
lv_plugin_img_set_src(image_closing_scr_uiflowclose, res[closing_index]);
|
||||
lv_label_set_text_fmt(label_1_scr_uiflowclose, "%ds", time_ms / 1000);
|
||||
time_ms -= UPDATE_TIMEER_MS;
|
||||
closing_index ++;
|
||||
if (time_ms == 0)
|
||||
{
|
||||
printf("task_update_timer_cb gPowerOff = %d\n", gPowerOff);
|
||||
Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 2, APP_POWER_OFF_APO, gPowerOff);
|
||||
if(update_timer){
|
||||
lv_task_del(update_timer);
|
||||
update_timer = NULL;
|
||||
// update_selftimer();
|
||||
};
|
||||
closing_index = closing_index % 4;
|
||||
lv_plugin_img_set_src(image_closing_scr_uiflowclose, res[closing_index]);
|
||||
lv_label_set_text_fmt(label_1_scr_uiflowclose, "%ds", time_ms / 1000);
|
||||
time_ms -= UPDATE_TIMEER_MS;
|
||||
closing_index ++;
|
||||
if (time_ms == 0)
|
||||
{
|
||||
printf("task_update_timer_cb gPowerOff = %d\n", gPowerOff);
|
||||
Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 2, APP_POWER_OFF_APO, gPowerOff);
|
||||
if(update_timer){
|
||||
lv_task_del(update_timer);
|
||||
update_timer = NULL;
|
||||
// update_selftimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void OpenClosingScreen(const DISPLAY_FINAL_E powerOff)
|
||||
{
|
||||
if (DISPLAY_FINAL_LOW_BATTERY == powerOff)
|
||||
{
|
||||
printf("[%s, %d]DISPLAY_FINAL_LOW_BATTERY\n", __FUNCTION__, __LINE__);
|
||||
lv_obj_set_hidden(image_closing_scr_uiflowclose, true);
|
||||
lv_obj_set_hidden(label_tips_scr_uiflowclose, true);
|
||||
lv_obj_set_hidden(label_2_scr_uiflowclose, false);
|
||||
lv_obj_set_hidden(image_2_scr_uiflowclose, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_set_hidden(image_closing_scr_uiflowclose, false);
|
||||
lv_obj_set_hidden(label_tips_scr_uiflowclose, false);
|
||||
lv_obj_set_hidden(label_2_scr_uiflowclose, true);
|
||||
lv_obj_set_hidden(image_2_scr_uiflowclose, true);
|
||||
}
|
||||
gPowerOff = powerOff;
|
||||
lv_plugin_scr_open(UIFlowClose, NULL);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
typedef enum {
|
||||
DISPLAY_FINAL_DO_NOT_SHOW_POWER_OFF = 0,
|
||||
DISPLAY_FINAL_SHOW_POWER_OFF,
|
||||
DISPLAY_FINAL_END
|
||||
DISPLAY_FINAL_END,
|
||||
DISPLAY_FINAL_LOW_BATTERY
|
||||
} DISPLAY_FINAL_E;
|
||||
void OpenClosingScreen(const DISPLAY_FINAL_E powerOff);
|
||||
#endif /*UIFLOW_CLOSE_EVENT_CALLBACK_H*/
|
|
@ -614,6 +614,19 @@ void UIFlowMenuCommonConfirmEventCallback(lv_obj_t* obj, lv_event_t event)
|
|||
break;
|
||||
}
|
||||
|
||||
case LV_USER_EVENT_NVTMSG:
|
||||
{
|
||||
const LV_USER_EVENT_NVTMSG_DATA* msg = (const LV_USER_EVENT_NVTMSG_DATA*)lv_event_get_data();
|
||||
if (msg->event == NVTEVT_BATTERY_LOW)
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "UIFlowLVGL/UIFlowLVGL.h"
|
||||
#include "UIApp/Network/UIAppNetwork.h"
|
||||
#include "UIFlowLVGL/UIFlowMenuCommonItem/MenuId.h"
|
||||
#include "UIFlowLVGL/UIFlowClose/UIFlowCloseEventCallback.h"
|
||||
#include <kwrap/debug.h>
|
||||
#include <regex.h>
|
||||
#include <unistd.h>
|
||||
|
@ -1203,6 +1204,18 @@ void UIFlowMenuCommonItemEventCallback(lv_obj_t* obj, lv_event_t event)
|
|||
lv_indev_wait_release(lv_indev_get_act());
|
||||
break;
|
||||
}
|
||||
case LV_USER_EVENT_NVTMSG:
|
||||
{
|
||||
const LV_USER_EVENT_NVTMSG_DATA* msg = (const LV_USER_EVENT_NVTMSG_DATA*)lv_event_get_data();
|
||||
if (msg->event == NVTEVT_BATTERY_LOW)
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "UIApp/Network/UIAppNetwork.h"
|
||||
#include <kwrap/debug.h>
|
||||
#include "UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmAPI.h"
|
||||
#include "UIFlowLVGL/UIFlowClose/UIFlowCloseEventCallback.h"
|
||||
#include "UIFlowLVGL/UIFlowMenuCommonItem/MenuId.h"
|
||||
#if HUNTING_CAMERA_MCU == ENABLE
|
||||
#include <sf_inc.h>
|
||||
|
@ -1899,6 +1900,18 @@ void UIFlowMenuCommonOptionEventCallback(lv_obj_t* obj, lv_event_t event)
|
|||
lv_indev_wait_release(lv_indev_get_act());
|
||||
break;
|
||||
}
|
||||
case LV_USER_EVENT_NVTMSG:
|
||||
{
|
||||
const LV_USER_EVENT_NVTMSG_DATA* msg = (const LV_USER_EVENT_NVTMSG_DATA*)lv_event_get_data();
|
||||
if (msg->event == NVTEVT_BATTERY_LOW)
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "UIFlowLVGL/UIFlowLVGL.h"
|
||||
#include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h"
|
||||
#include "UIFlowLVGL/UIFlowPassword/UIFlowPasswordEventCallback.h"
|
||||
#include "UIFlowLVGL/UIFlowClose/UIFlowCloseEventCallback.h"
|
||||
#include "UIFlowLVGL/UIFlowCommon/UIFlowCommon.h"
|
||||
#include <kwrap/debug.h>
|
||||
#include "SysMain.h"
|
||||
|
@ -1417,6 +1418,13 @@ static void UIFlowMovie_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* m
|
|||
break;
|
||||
}
|
||||
|
||||
case NVTEVT_BATTERY_LOW:
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
|
||||
//#NT#2021/09/10#Philex Lin--begin
|
||||
case NVTEVT_CB_MOVIE_REC_FINISH:
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "sf_mcu.h"
|
||||
#include "sf_common.h"
|
||||
#include <stdio.h>
|
||||
#include "UIFlowLVGL/UIFlowClose/UIFlowCloseEventCallback.h"
|
||||
|
||||
|
||||
static int PasswordIndex = 0;
|
||||
|
@ -440,6 +441,18 @@ printf(" UIFlowPasswordEventCallback %d\n", event);
|
|||
{
|
||||
break;
|
||||
}
|
||||
case LV_USER_EVENT_NVTMSG:
|
||||
{
|
||||
const LV_USER_EVENT_NVTMSG_DATA* msg = (const LV_USER_EVENT_NVTMSG_DATA*)lv_event_get_data();
|
||||
if (msg->event == NVTEVT_BATTERY_LOW)
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "UIFlowLVGL/UIFlowLVGL.h"
|
||||
#include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h"
|
||||
#include "UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmAPI.h"
|
||||
#include "UIFlowLVGL/UIFlowClose/UIFlowCloseEventCallback.h"
|
||||
#include "UIFlowLVGL/UIFlowPassword/UIFlowPasswordEventCallback.h"
|
||||
#include "UIFlowLVGL/UIFlowClose/UIFlowCloseEventCallback.h"
|
||||
#include "UIFlowLVGL_SPORTCAM.h"
|
||||
|
@ -373,7 +374,7 @@ static void update_battery(void)
|
|||
// #else
|
||||
// lv_plugin_img_set_src(image_battery_0_scr_uiflowphoto, res[GetBatteryLevel()]);
|
||||
// #endif
|
||||
|
||||
//printf("[%s:%d]battery: %d\n", __FUNCTION__, __LINE__, sf_cardv_battery_level_get());
|
||||
lv_plugin_img_set_src(image_battery_0_scr_uiflowphoto, res[sf_cardv_battery_level_get()]);
|
||||
|
||||
}
|
||||
|
@ -1893,6 +1894,15 @@ static void task_update_icons_timer_cb(lv_task_t* task)
|
|||
|
||||
if (autoOffTime >= ShutDownTime - is_password && autoOffTime < ShutDownTime + 3)
|
||||
{
|
||||
if (sf_cardv_battery_level_get() == 0)
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
while(true)
|
||||
{
|
||||
usleep(100);
|
||||
}
|
||||
}
|
||||
printf("[%s]go to shutdown", __FUNCTION__);
|
||||
// unsigned int autoCloseTime_s = ShutDownTime == GO_TO_WORK_MODE_TIME ? 30 : 3;
|
||||
if (GO_TO_WORK_MODE_TIME == ShutDownTime || MENU_GO_TO_WORK_MODE_TIME_S == ShutDownTime)
|
||||
|
@ -2108,8 +2118,11 @@ static void UIFlowPhoto_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* m
|
|||
break;
|
||||
|
||||
case NVTEVT_BATTERY_LOW:
|
||||
UIFlowPhoto_OnBatteryLow(obj, msg);
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
case NVTEVT_BACKGROUND_DONE:
|
||||
{
|
||||
NVTEVT message=msg->paramArray[ONDONE_PARAM_INDEX_CMD];
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h"
|
||||
#include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h"
|
||||
#include "UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmAPI.h"
|
||||
#include "UIFlowLVGL/UIFlowClose/UIFlowCloseEventCallback.h"
|
||||
#include "kwrap/nvt_type.h"
|
||||
#include "SF_SysStrgMng.h"
|
||||
#if (USE_DCF == ENABLE)
|
||||
|
@ -1411,6 +1412,13 @@ static void UIFlowPlay_ChildScrClose(lv_obj_t* obj, const void * data)
|
|||
|
||||
//Return from thumbnail, magnify or delete mode and play current image again.
|
||||
switch (msg->event) {
|
||||
case NVTEVT_BATTERY_LOW:
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
|
||||
case NVTRET_THUMBNAIL:
|
||||
case NVTRET_MAGNIFY:
|
||||
g_PlbData.State = PLB_ST_FULL;
|
||||
|
@ -2579,6 +2587,12 @@ static void UIFlowPlay_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* ms
|
|||
{
|
||||
switch(msg->event)
|
||||
{
|
||||
case NVTEVT_BATTERY_LOW:
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
case NVTEVT_CB_MOVIE_FINISH:
|
||||
{
|
||||
UIFlowPlay_CB_Finish(obj,msg);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "GxStrg.h"
|
||||
#include <kwrap/debug.h>
|
||||
#include "NVTUserCommand.h"
|
||||
#include "UIFlowLVGL/UIFlowClose/UIFlowCloseEventCallback.h"
|
||||
#if HUNTING_CAMERA_MCU == ENABLE
|
||||
#include <sf_inc.h>
|
||||
#endif
|
||||
|
@ -806,6 +807,12 @@ static void UIFlowPlayThumb_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DAT
|
|||
|
||||
break;
|
||||
}
|
||||
case NVTEVT_BATTERY_LOW:
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -426,6 +426,18 @@ void message_box_wrnmsg_event_callback(lv_obj_t* obj, lv_event_t event)
|
|||
|
||||
break;
|
||||
}
|
||||
case LV_USER_EVENT_NVTMSG:
|
||||
{
|
||||
const LV_USER_EVENT_NVTMSG_DATA* msg = (const LV_USER_EVENT_NVTMSG_DATA*)lv_event_get_data();
|
||||
if (msg->event == NVTEVT_BATTERY_LOW)
|
||||
{
|
||||
#define DISPLAY_FINAL_LOW_BATTERY 3
|
||||
OpenClosingScreen(DISPLAY_FINAL_LOW_BATTERY);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1987,15 +1987,17 @@ static SINT32 sf_cardv_proccess_cmd_poweroff(SF_MESSAGE_BUF_S *pMessageBuf)
|
|||
|
||||
//MLOGI("ID = %#x\n",pMessageBuf->arg1);
|
||||
|
||||
|
||||
switch(pMessageBuf->arg1)
|
||||
{
|
||||
case APP_POWER_OFF_BATT_EMPTY:
|
||||
Ux_PostEvent(NVTEVT_BATTERY_LOW, NULL, NULL);
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, pMessageBuf->arg1); //shutdown start
|
||||
/*switch(pMessageBuf->arg1)
|
||||
{
|
||||
case APP_POWER_OFF_BATT_EMPTY:
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
void* sf_cardv_message_thread(void *argv)
|
||||
|
|
Loading…
Reference in New Issue
Block a user