1.实现设置界面的SD卡格式化的功能
This commit is contained in:
		
							parent
							
								
									12955a038b
								
							
						
					
					
						commit
						b8027138af
					
				| 
						 | 
				
			
			@ -4,7 +4,7 @@
 | 
			
		|||
#include "UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmAPI.h"
 | 
			
		||||
#include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h"
 | 
			
		||||
#include <kwrap/debug.h>
 | 
			
		||||
 | 
			
		||||
#include "sf_sd_common.h"
 | 
			
		||||
 | 
			
		||||
static UINT32 gBKGEvt = 0;
 | 
			
		||||
static UINT32 gExeEvt = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -174,11 +174,13 @@ void UIFlowMenuCommonConfirm_OnChildScrClose(lv_obj_t* obj, const LV_USER_EVENT_
 | 
			
		|||
	set_indev_keypad_group(msgbox);
 | 
			
		||||
 | 
			
		||||
	if(msg){
 | 
			
		||||
 | 
			
		||||
		const char* msgbox_text = lv_msgbox_get_text(msgbox);
 | 
			
		||||
		const char* erase_text = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRID_ERASE_THIS)->ptr;
 | 
			
		||||
 | 
			
		||||
		if(msg->event == NVTRET_WAITMOMENT || strcmp(msgbox_text, erase_text) == 0){
 | 
			
		||||
		if(msg->event == NVTRET_WAITMOMENT ||
 | 
			
		||||
			msg->event == NVTRET_FORMAT ||
 | 
			
		||||
			strcmp(msgbox_text, erase_text) == 0)
 | 
			
		||||
		{
 | 
			
		||||
			UIFlowMenuCommonConfirm_CloseScr();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -259,8 +261,18 @@ static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint3
 | 
			
		|||
			// #endif
 | 
			
		||||
 | 
			
		||||
			UIFlowMenuCommonConfirm_CloseScr();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		} else if (gBKGEvt == NVTEVT_BKW_FORMAT_CARD) {
 | 
			
		||||
			if(sf_in_card_exist() == TRUE)
 | 
			
		||||
			{
 | 
			
		||||
				lv_obj_set_hidden(msgbox, true);
 | 
			
		||||
				UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_FORMATING, 20000);
 | 
			
		||||
				BKG_PostEvent(NVTEVT_BKW_FORMAT_CARD);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				lv_obj_set_hidden(msgbox, true);
 | 
			
		||||
				UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_NO_SD, 3000);
 | 
			
		||||
			}
 | 
			
		||||
		} else if (gBKGEvt) {
 | 
			
		||||
			DBG_FUNC("gBKGEvt=%d\r\n",gBKGEvt);
 | 
			
		||||
			lv_plugin_scr_open(wait_moment_scr, &string_id_please_wait);
 | 
			
		||||
| 
						 | 
				
			
			@ -286,6 +298,7 @@ static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint3
 | 
			
		|||
 | 
			
		||||
void UIFlowMenuCommonConfirmEventCallback(lv_obj_t* obj, lv_event_t event)
 | 
			
		||||
{
 | 
			
		||||
	printf("[%s]event:%d\n", __FUNCTION__, event);
 | 
			
		||||
 | 
			
		||||
	switch(event)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -323,6 +336,8 @@ void UIFlowMenuCommonConfirmEventCallback(lv_obj_t* obj, lv_event_t event)
 | 
			
		|||
 | 
			
		||||
void message_box_confirm_msg_event_callback(lv_obj_t* obj, lv_event_t event)
 | 
			
		||||
{
 | 
			
		||||
	printf("[%s]event:%d\n", __FUNCTION__, event);
 | 
			
		||||
	
 | 
			
		||||
	switch(event)
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
#include "UIFlowLVGL/UIFlowLVGL.h"
 | 
			
		||||
#include "UIApp/Network/UIAppNetwork.h"
 | 
			
		||||
#include <kwrap/debug.h>
 | 
			
		||||
#include "UIFlowLVGL/UIFlowMenuCommonConfirm/UIFlowMenuCommonConfirmAPI.h"
 | 
			
		||||
#if HUNTING_CAMERA_MCU == ENABLE
 | 
			
		||||
#include <sf_inc.h>
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -145,6 +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);
 | 
			
		||||
		return MESSAGE_ITEM_TRUE;
 | 
			
		||||
	}
 | 
			
		||||
	case IDM_DATE_AND_TIME:
 | 
			
		||||
| 
						 | 
				
			
			@ -639,6 +641,17 @@ static void UIFlowMenuCommonOption_ChildScrClose(lv_obj_t* obj)
 | 
			
		|||
 | 
			
		||||
	set_indev_keypad_group(obj);
 | 
			
		||||
 | 
			
		||||
	TM_MENU*    pMenu = TM_GetMenu();
 | 
			
		||||
	TM_PAGE*    pPage;
 | 
			
		||||
	TM_ITEM*    pItem;
 | 
			
		||||
	pPage = &pMenu->pPages[pMenu->SelPage];
 | 
			
		||||
	pItem = &pPage->pItems[pPage->SelItem];
 | 
			
		||||
	UINT16 itemID = pItem->ItemId;
 | 
			
		||||
 | 
			
		||||
	if(itemID == IDM_FORMAT_SD)
 | 
			
		||||
	{
 | 
			
		||||
		lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void UIFlowMenuCommonOption_ScrOpen(lv_obj_t* obj, const void *data)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
#include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h"
 | 
			
		||||
#include "UIFlowLVGL/UIFlowLVGL.h"
 | 
			
		||||
#include <kwrap/debug.h>
 | 
			
		||||
#include "sf_sd_common.h"
 | 
			
		||||
 | 
			
		||||
/**************************************************************
 | 
			
		||||
 * static variables
 | 
			
		||||
| 
						 | 
				
			
			@ -124,10 +125,42 @@ void UIFlowWrnMsgEventCallback_OnOpen(lv_obj_t* obj)
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void UIFlowWrnMsg_OnNVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* msg)
 | 
			
		||||
{
 | 
			
		||||
	NVTEVT message=msg->paramArray[ONDONE_PARAM_INDEX_CMD];
 | 
			
		||||
	switch(msg->event)
 | 
			
		||||
	{
 | 
			
		||||
	case NVTEVT_BACKGROUND_DONE:
 | 
			
		||||
		switch (message)
 | 
			
		||||
		{
 | 
			
		||||
		case NVTEVT_BKW_FORMAT_CARD:
 | 
			
		||||
		{
 | 
			
		||||
			int ret = sf_get_card_statu();
 | 
			
		||||
			if(ret == CMD_FORMAT_SD_OK)
 | 
			
		||||
			{
 | 
			
		||||
				lv_plugin_msgbox_set_text(msgbox, LV_PLUGIN_STRING_ID_STRING_COMPLETED);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				lv_plugin_msgbox_set_text(msgbox, LV_PLUGIN_STRING_ID_STRING_FORMAT_ERR);
 | 
			
		||||
			}
 | 
			
		||||
			lv_msgbox_start_auto_close(msgbox, 3000);
 | 
			
		||||
			printf("[%s]start auto close 3000ms", __FUNCTION__);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		default:
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UIFlowWrnMsgEventCallback(lv_obj_t* obj, lv_event_t event)
 | 
			
		||||
{
 | 
			
		||||
	printf("[%s]event:%d\n", __FUNCTION__, event);
 | 
			
		||||
 | 
			
		||||
	switch(event)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -155,6 +188,14 @@ void UIFlowWrnMsgEventCallback(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();
 | 
			
		||||
 | 
			
		||||
		UIFlowWrnMsg_OnNVTMSG(obj, msg);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -195,6 +236,7 @@ void message_box_wrnmsg_OnKey(lv_obj_t* msgbox, uint32_t key)
 | 
			
		|||
 | 
			
		||||
void message_box_wrnmsg_event_callback(lv_obj_t* obj, lv_event_t event)
 | 
			
		||||
{
 | 
			
		||||
	printf("[%s]event:%d\n", __FUNCTION__, event);
 | 
			
		||||
    switch (event)
 | 
			
		||||
    {
 | 
			
		||||
		case LV_EVENT_KEY:
 | 
			
		||||
| 
						 | 
				
			
			@ -220,6 +262,11 @@ 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)
 | 
			
		||||
			{
 | 
			
		||||
				evt = NVTRET_FORMAT;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
    		/* parent is UIFlowWrnMsg */
 | 
			
		||||
    		if(evt != NVTEVT_NULL){
 | 
			
		||||
    			lv_plugin_scr_close(lv_obj_get_parent(obj), gen_nvtmsg_data(evt, 0));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user