From 0c3672cafa6fc7989632e6eeba95ab7f6f4f815d Mon Sep 17 00:00:00 2001 From: zyj Date: Thu, 26 Oct 2023 14:39:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E5=8D=87=E7=BA=A7=EF=BC=8C=E6=A8=A1=E5=9D=97=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=EF=BC=8C=E8=AE=BE=E5=A4=87=E9=87=8D=E7=BD=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIApp/Background/UIBackgroundObj.c | 27 +++++++++ .../UIApp/Background/UIBackgroundObj.h | 4 ++ .../UIFlowMenuCommonConfirmEventCallback.c | 56 ++++++++++++++++++- .../UIFlowMenuCommonOptionEventCallback.c | 16 +++++- .../UIFlowWrnMsg/UIFlowWrnMsgEventCallback.c | 22 +++++++- 5 files changed, 120 insertions(+), 5 deletions(-) diff --git a/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.c b/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.c index 31e25200a..a59b5bb26 100755 --- a/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.c +++ b/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.c @@ -1,4 +1,5 @@ #include "PrjInc.h" +#include "sf_param_common.h" #include "sys_mempool.h" #include "Dx.h" #include "FileDB.h" @@ -94,6 +95,9 @@ static UINT32 BackgroundEthCamCheckPortReady(void); static UINT32 BackgroundEthCamUpdateUIInfo(void); static UINT32 BackgroundEthCamIperfTest(void); #endif +static UINT32 BackgroundCameraFWUpgrade(void); +static UINT32 BackgroundModuleFWUpgrade(void); +static UINT32 BackgroundReset(void); static UINT32 g_uiDpofOPMode = PLAYDPOF_SETONE; static UINT32 g_uiDpofPrtNum = 0; @@ -187,6 +191,9 @@ BKG_JOB_ENTRY gBackgroundExtFuncTable[] = { #endif + {NVTEVT_BKW_CAMERA_FW_UPGRADE, BackgroundCameraFWUpgrade}, + {NVTEVT_BKW_MODULE_FW_UPGRADE, BackgroundModuleFWUpgrade}, + {NVTEVT_BKW_RESET, BackgroundReset}, {0, 0}, }; @@ -1896,6 +1903,26 @@ static UINT32 BackgroundEthCamIperfTest(void) #endif +UINT32 BackgroundCameraFWUpgrade(void) +{ + sf_do_upgrade_thread(); + return TRUE; +} + +UINT32 BackgroundModuleFWUpgrade(void) +{ + sf_set_module_update(1); + return TRUE; +} + +UINT32 BackgroundReset(void) +{ + Reset_MenuInfo(); + sf_sleep_ms(500); + Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, APP_POWER_OFF_NORMAL); + return TRUE; +} + void AppBKW_SetData(BKW_DATA_SET attribute, UINT32 value) { switch (attribute) { diff --git a/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.h b/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.h index 1354b8a9e..638689149 100755 --- a/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.h +++ b/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.h @@ -47,6 +47,10 @@ typedef enum { NVTEVT_BKW_ETHCAM_UPDATE_UI, NVTEVT_BKW_ETHCAM_IPERF_TEST, + NVTEVT_BKW_CAMERA_FW_UPGRADE, + NVTEVT_BKW_MODULE_FW_UPGRADE, + NVTEVT_BKW_RESET, + NVTEVT_BKW_END, } NVT_BKW_CMD; #define PLAYDPOF_SETONE 0x00000002 diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmEventCallback.c index b3ca161cf..1876a6a81 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmEventCallback.c @@ -5,6 +5,7 @@ #include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h" #include #include "sf_sd_common.h" +#include "sf_common.h" static UINT32 gBKGEvt = 0; static UINT32 gExeEvt = 0; @@ -105,6 +106,22 @@ void UIFlowMenuCommonConfirmAPI_Open(uint32_t itemID) case IDM_DELETE_THIS: strID = LV_PLUGIN_STRING_ID_STRID_ERASE_THIS; break; + case IDM_FORMAT_SD: + strID = LV_PLUGIN_STRING_ID_STRING_FORMAT_SD; + gBKGEvt = NVTEVT_BKW_FORMAT_CARD; + break; + case IDM_CAMERA_FW_UPGRADE: + strID = LV_PLUGIN_STRING_ID_STRING_CAMERA_FW_UPGRADE; + gBKGEvt = NVTEVT_BKW_CAMERA_FW_UPGRADE; + break; + case IDM_MODULE_FW_UPGRADE: + strID = LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE; + gBKGEvt = NVTEVT_BKW_MODULE_FW_UPGRADE; + break; + case IDM_RESET: + strID = LV_PLUGIN_STRING_ID_STRING_RESET_WARNING; + gBKGEvt = NVTEVT_BKW_RESET; + break; default: gBKGEvt = 0; DBG_ERR("error itemID %d\r\n", gItemID); @@ -114,6 +131,15 @@ void UIFlowMenuCommonConfirmAPI_Open(uint32_t itemID) /* set text by string id */ lv_plugin_msgbox_set_text(msgbox, strID); + // if(gItemID == IDM_RESET) + // { + // const lv_plugin_string_t* tmpstr1 = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRING_RESET_WARNING); + // const lv_plugin_string_t* tmpstr2 = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRING_RESET_RESTART); + // printf("%s\n%s",tmpstr1->ptr,tmpstr2->ptr); + // lv_msgbox_set_text_fmt(msgbox, "%s\n%s",tmpstr1->ptr,tmpstr2->ptr); + + // } + /* update font of message part */ lv_plugin_msgbox_update_font(msgbox, LV_MSGBOX_PART_BG); @@ -178,7 +204,7 @@ void UIFlowMenuCommonConfirm_OnChildScrClose(lv_obj_t* obj, const LV_USER_EVENT_ const char* erase_text = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRID_ERASE_THIS)->ptr; if(msg->event == NVTRET_WAITMOMENT || - msg->event == NVTRET_FORMAT || + msg->event == NVTRET_ENTER_MENU || strcmp(msgbox_text, erase_text) == 0) { UIFlowMenuCommonConfirm_CloseScr(); @@ -273,6 +299,34 @@ static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint3 lv_obj_set_hidden(msgbox, true); UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_NO_SD, 3000); } + } else if (gBKGEvt == NVTEVT_BKW_CAMERA_FW_UPGRADE) { + if(sf_cardv_battery_value_get() < 40) + { + lv_obj_set_hidden(msgbox, true); + UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_UPGRADE_ERR, 3000); + } + else + { + lv_obj_set_hidden(msgbox, true); + UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_UPGRADING, 60000); + BKG_PostEvent(gBKGEvt); + } + } else if (gBKGEvt == NVTEVT_BKW_MODULE_FW_UPGRADE) { + if(sf_cardv_battery_value_get() < 40) + { + lv_obj_set_hidden(msgbox, true); + UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_UPGRADE_LOWBAT, 3000); + } + else + { + lv_obj_set_hidden(msgbox, true); + UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_UPGRADING, 60000); + BKG_PostEvent(gBKGEvt); + } + } else if (gBKGEvt == NVTEVT_BKW_RESET) { + lv_obj_set_hidden(msgbox, true); + UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_COMPLETED, 10000); + BKG_PostEvent(gBKGEvt); } else if (gBKGEvt) { DBG_FUNC("gBKGEvt=%d\r\n",gBKGEvt); lv_plugin_scr_open(wait_moment_scr, &string_id_please_wait); diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonOption/UIFlowMenuCommonOptionEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonOption/UIFlowMenuCommonOptionEventCallback.c index dfa4751dc..8c74af680 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonOption/UIFlowMenuCommonOptionEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonOption/UIFlowMenuCommonOptionEventCallback.c @@ -146,7 +146,7 @@ static int is_message_item(lv_obj_t* obj) case IDM_FORMAT_SD: { printf("[is_message_item]IDM_FORMAT_SD\n"); - UIFlowMenuCommonConfirmAPI_Open(IDM_FORMAT); + UIFlowMenuCommonConfirmAPI_Open(itemID); return MESSAGE_ITEM_TRUE; } case IDM_DATE_AND_TIME: @@ -158,6 +158,15 @@ static int is_message_item(lv_obj_t* obj) case IDM_CHECK_IN_PHOTO: case IDM_GPS: break; + + case IDM_BATTERY_TYPE: + case IDM_SD_LOOP: + break; + case IDM_CAMERA_FW_UPGRADE: + case IDM_MODULE_FW_UPGRADE: + case IDM_RESET: + UIFlowMenuCommonConfirmAPI_Open(itemID); + return MESSAGE_ITEM_TRUE; default: break; } @@ -648,7 +657,10 @@ static void UIFlowMenuCommonOption_ChildScrClose(lv_obj_t* obj) pItem = &pPage->pItems[pPage->SelItem]; UINT16 itemID = pItem->ItemId; - if(itemID == IDM_FORMAT_SD) + if(itemID == IDM_FORMAT_SD || + itemID == IDM_CAMERA_FW_UPGRADE || + itemID == IDM_MODULE_FW_UPGRADE || + itemID == IDM_RESET) { lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0)); } diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgEventCallback.c index 90c6fc07f..ea73483ff 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgEventCallback.c @@ -3,6 +3,7 @@ #include "UIFlowLVGL/UIFlowLVGL.h" #include #include "sf_sd_common.h" +#include "sf_commu_mcu_reg.h" /************************************************************** * static variables @@ -91,6 +92,14 @@ void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_time lv_plugin_msgbox_set_text(msgbox, id); } + // if(LV_PLUGIN_STRING_ID_STRING_UPGRADING == msgID) + // { + // const lv_plugin_string_t* tmpstr1 = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRING_UPGRADING); + // const lv_plugin_string_t* tmpstr2 = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRING_UPGRADE_WARNING); + // printf("%s\n%s",tmpstr1->ptr,tmpstr2->ptr); + // lv_msgbox_set_text_fmt(msgbox, "%s\n%s",tmpstr1->ptr,tmpstr2->ptr); + // } + /* add button */ // btn_map[0] = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRID_OK)->ptr; // lv_msgbox_add_btns(msgbox, btn_map); @@ -137,6 +146,7 @@ static void UIFlowWrnMsg_OnNVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA { case NVTEVT_BKW_FORMAT_CARD: { + int ret = sf_get_card_statu(); if(ret == CMD_FORMAT_SD_OK) { @@ -150,6 +160,13 @@ static void UIFlowWrnMsg_OnNVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA printf("[%s]start auto close 3000ms", __FUNCTION__); break; } + case NVTEVT_BKW_CAMERA_FW_UPGRADE: + case NVTEVT_BKW_MODULE_FW_UPGRADE: + case NVTEVT_BKW_RESET: + { + break; + } + default: break; } @@ -262,9 +279,10 @@ void message_box_wrnmsg_event_callback(lv_obj_t* obj, lv_event_t event) /* reset pointer of msgbox */ msgbox = NULL; - if(msgID == LV_PLUGIN_STRING_ID_STRING_NO_SD || msgID == LV_PLUGIN_STRING_ID_STRING_FORMATING) + if(msgID == LV_PLUGIN_STRING_ID_STRING_NO_SD || + msgID == LV_PLUGIN_STRING_ID_STRING_FORMATING) { - evt = NVTRET_FORMAT; + evt = NVTRET_ENTER_MENU; } /* parent is UIFlowWrnMsg */