Merge branch 'Branch_S550_GUI' of 192.168.6.216:/linux-em-group/s530-ntk into branch_s550_gui_debug

This commit is contained in:
zyj 2023-10-26 14:41:39 +08:00
commit e3969e2d00
3 changed files with 296 additions and 2 deletions

View File

@ -1,4 +1,5 @@
#include "PrjInc.h"
#include "UIFlowLVGL/UIFlowMenuCommonItem/MenuSend.h"
#include "UIWnd/UIFlow.h"
TMDEF_BEGIN_OPTIONS(MAX_NUM_DAY)
@ -72,6 +73,25 @@ int Send_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
case IDM_SEND_TYPE:
{
puiPara->SendType = uwOption;
puiPara->TimeSend4Switch = 0;
puiPara->TimeSend3Switch = 0;
puiPara->TimeSend2Switch = 0;
puiPara->TimeSend1Switch = 0;
switch (uwOption)
{
case FOUR_TIME_DAY:
puiPara->TimeSend4Switch = 1;
break;
case TWICE_DAY:
puiPara->TimeSend3Switch = 1;
break;
case ONCE_DAY:
puiPara->TimeSend2Switch = 1;
break;
default:
puiPara->TimeSend1Switch = 1;
break;
}
printf("\033[33m[Send_MenuCallback]SendType:%d\033[0m\n", puiPara->SendType);
break;
}
@ -306,4 +326,259 @@ void Option_MaxNum_Key(lv_obj_t* obj, uint32_t key)
}
}
// --------------------------------------------------------------------------
// Send type
// --------------------------------------------------------------------------
#define TIME_BUF_LENGTH 3
static int gSendType = -1;
static int gMatrixIndex = 0;
#define FIRST_PAGE 0
#define SECOND_PAGE 1
static int gPageNum = 0;
#define SET_TIME_NUM 4
static SF_PARA_TIME_S gSendTime[SET_TIME_NUM] = {'0'};
static int SendTimeIndex_0 = 0;
static lv_obj_t* SendTimeMatrixObj_0 = NULL;
static char SendTimeHHBuf1[TIME_BUF_LENGTH] = {'0', '0', 0};
static char SendTimeMMBuf1[TIME_BUF_LENGTH] = {'0', '0', 0};
static char SendTimeHHBuf2[TIME_BUF_LENGTH] = {'0', '0', 0};
static char SendTimeMMBuf2[TIME_BUF_LENGTH] = {'0', '0', 0};
#define BUTTON_NUM_4 4
#define BUTTON_NUM_8 8
static const char* SendTimeMap_0[BUTTON_NUM_8] =
{
SendTimeHHBuf1,
":",
SendTimeMMBuf1,
" ",
SendTimeHHBuf2,
":",
SendTimeMMBuf2,
""
};
static int SendTimeIndex_1 = 0;
static lv_obj_t* SendTimeMatrixObj_1 = NULL;
// static char SendTimeHHBuf1[TIME_BUF_LENGTH] = {'0', '0', 0};
// static char SendTimeMMBuf1[TIME_BUF_LENGTH] = {'0', '0', 0};
// static char SendTimeHHBuf2[TIME_BUF_LENGTH] = {'0', '0', 0};
// static char SendTimeMMBuf2[TIME_BUF_LENGTH] = {'0', '0', 0};
static const char* SendTimeMap_1[BUTTON_NUM_4] =
{
SendTimeHHBuf1,
":",
SendTimeMMBuf1,
""
};
static void update_send_time_msg(lv_obj_t* obj)
{
// UIMenuStoreInfo *puiPara = sf_ui_para_get();
printf(" page now is %d\n", gPageNum);
unsigned short settingIndex = gPageNum * 2;
snprintf(SendTimeHHBuf1, TIME_BUF_LENGTH, "%02d", gSendTime[settingIndex + 0].Hour);
snprintf(SendTimeMMBuf1, TIME_BUF_LENGTH, "%02d", gSendTime[settingIndex + 0].Min);
snprintf(SendTimeHHBuf2, TIME_BUF_LENGTH, "%02d", gSendTime[settingIndex + 1].Hour);
snprintf(SendTimeMMBuf2, TIME_BUF_LENGTH, "%02d", gSendTime[settingIndex + 1].Min);
lv_btnmatrix_set_focused_btn(SendTimeMatrixObj_0, gMatrixIndex);
lv_btnmatrix_set_focused_btn(SendTimeMatrixObj_1, gMatrixIndex);
}
void show_send_time_page(lv_obj_t* obj, const int sendType)
{
gMatrixIndex = 0;
SendTimeIndex_0 = 0;
SendTimeIndex_1 = 0;
gSendType = sendType;
gPageNum = FIRST_PAGE;
unsigned short settingIndex = gPageNum * 2;
init_Matrix_style();
UIMenuStoreInfo *puiPara = sf_ui_para_get();
memcpy(&gSendTime[0], &(puiPara->TimeSend1), sizeof(SF_PARA_TIME_S));
memcpy(&gSendTime[1], &(puiPara->TimeSend2), sizeof(SF_PARA_TIME_S));
memcpy(&gSendTime[2], &(puiPara->TimeSend3), sizeof(SF_PARA_TIME_S));
memcpy(&gSendTime[3], &(puiPara->TimeSend4), sizeof(SF_PARA_TIME_S));
// if(!puiPara->WorkTime1Switch)
// {
// gSendTime[0].Hour = 0;
// gSendTime[0].Min = 0;
// gSendTime[1].Hour = 0;
// gSendTime[1].Min = 0;
// }
snprintf(SendTimeHHBuf1, TIME_BUF_LENGTH, "%02d", gSendTime[settingIndex + 0].Hour);
snprintf(SendTimeMMBuf1, TIME_BUF_LENGTH, "%02d", gSendTime[settingIndex + 0].Min);
snprintf(SendTimeHHBuf2, TIME_BUF_LENGTH, "%02d", gSendTime[settingIndex + 1].Hour);
snprintf(SendTimeMMBuf2, TIME_BUF_LENGTH, "%02d", gSendTime[settingIndex + 1].Min);
SendTimeMatrixObj_0 = lv_btnmatrix_create(obj, NULL);
lv_obj_set_hidden(SendTimeMatrixObj_0, false);
lv_obj_set_click(SendTimeMatrixObj_0, true);
lv_obj_set_drag(SendTimeMatrixObj_0, false);
lv_obj_set_pos(SendTimeMatrixObj_0, 65, 58);
lv_obj_set_size(SendTimeMatrixObj_0, 190, 140);
lv_btnmatrix_set_map(SendTimeMatrixObj_0, SendTimeMap_0);
lv_btnmatrix_set_one_check(SendTimeMatrixObj_0, true);
lv_btnmatrix_set_align(SendTimeMatrixObj_0, LV_LABEL_ALIGN_CENTER);
lv_btnmatrix_set_focused_btn(SendTimeMatrixObj_0,0);
lv_btnmatrix_set_one_check(SendTimeMatrixObj_0, false);
lv_obj_add_style(SendTimeMatrixObj_0, 0, &gMatrixStylebg);
lv_obj_add_style(SendTimeMatrixObj_0, 1, &gMatrixStylebtn);
SendTimeMatrixObj_1 = lv_btnmatrix_create(obj, NULL);
lv_obj_set_hidden(SendTimeMatrixObj_1, false);
lv_obj_set_click(SendTimeMatrixObj_1, true);
lv_obj_set_drag(SendTimeMatrixObj_1, false);
lv_obj_set_pos(SendTimeMatrixObj_1, 65, 158);
lv_obj_set_size(SendTimeMatrixObj_1, 190, 140);
lv_btnmatrix_set_map(SendTimeMatrixObj_1, SendTimeMap_1);
lv_btnmatrix_set_one_check(SendTimeMatrixObj_1, true);
lv_btnmatrix_set_align(SendTimeMatrixObj_1, LV_LABEL_ALIGN_CENTER);
lv_btnmatrix_set_focused_btn(SendTimeMatrixObj_1,0);
lv_btnmatrix_set_one_check(SendTimeMatrixObj_1, false);
lv_obj_add_style(SendTimeMatrixObj_1, 0, &gMatrixStylebg);
lv_obj_add_style(SendTimeMatrixObj_1, 1, &gMatrixStylebtn);
}
void hidde_send_time_page(void)
{
if(SendTimeMatrixObj_0)
{
lv_obj_del(SendTimeMatrixObj_0);
}
if(SendTimeMatrixObj_1)
{
lv_obj_del(SendTimeMatrixObj_1);
}
}
void Option_send_time_Key(lv_obj_t* obj, uint32_t key)
{
// if(OperatingTimeMatrixObj == NULL)
// {
// printf("OperatingTimeMatrixObj is NULL");
// return;
// }
// char result[2];
// lv_obj_t* matrixObj = NULL;
unsigned short buttonNum = 0;
unsigned short settingIndex = gPageNum * 2;
if(ONCE_DAY == gSendType)
{
buttonNum = BUTTON_NUM_4;
}
else
{
buttonNum = BUTTON_NUM_8;
}
UIMenuStoreInfo *puiPara = sf_ui_para_get();
printf("key:%d\n",key);
switch(key)
{
case LV_USER_KEY_NEXT:
printf("\033[33m[Option_send_time_Key]s\033[0m\n");
if(gMatrixIndex == 0)
{
if(gSendTime[settingIndex + 0].Hour > 0 && gSendTime[settingIndex + 0].Hour <= 23)
gSendTime[settingIndex + 0].Hour--;
else
gSendTime[0].Hour = 23;
}
else if(gMatrixIndex == 2)
{
if(gSendTime[settingIndex + 0].Min > 0 && gSendTime[settingIndex + 0].Min <= 59)
gSendTime[settingIndex + 0].Min--;
else
gSendTime[settingIndex + 0].Min = 59;
}
else if(gMatrixIndex == 4)
{
if(gSendTime[settingIndex + 1].Hour > 0 && gSendTime[settingIndex + 1].Hour <= 23)
gSendTime[settingIndex + 1].Hour--;
else
gSendTime[settingIndex + 1].Hour = 23;
}
else if(gMatrixIndex == 6)
{
if(gSendTime[settingIndex + 1].Min > 0 && gSendTime[settingIndex + 1].Min <= 59)
gSendTime[settingIndex + 1].Min--;
else
gSendTime[settingIndex + 1].Min = 59;
}
update_send_time_msg(obj);
break;
case LV_USER_KEY_PREV:
printf("\033[33m[Option_send_time_Key]w\033[0m\n");
if(gMatrixIndex == 0)
{
if(gSendTime[settingIndex + 0].Hour >= 23)
gSendTime[settingIndex + 0].Hour = 0;
else
gSendTime[settingIndex + 0].Hour++;
}
else if(gMatrixIndex == 2)
{
if(gSendTime[settingIndex + 0].Min >= 59)
gSendTime[settingIndex + 0].Min = 0;
else
gSendTime[settingIndex + 0].Min++;
}
else if(gMatrixIndex == 4)
{
if(gSendTime[settingIndex + 1].Hour >= 23)
gSendTime[settingIndex + 1].Hour = 0;
else
gSendTime[settingIndex + 1].Hour++;
}
else if(gMatrixIndex == 6)
{
if(gSendTime[settingIndex + 1].Min >= 59)
gSendTime[settingIndex + 1].Min = 0;
else
gSendTime[settingIndex + 1].Min++;
}
update_send_time_msg(obj);
break;
case LV_USER_KEY_LEFT:
gMatrixIndex = (gMatrixIndex - 2 + 8) % buttonNum;
printf("\033[33m[Option_send_time_Key]a gMatrixIndex = %d\033[0m\n", gMatrixIndex);
if(buttonNum - 2 == gMatrixIndex && FIRST_PAGE == gPageNum && FOUR_TIME_DAY == gSendType)
{
gPageNum = SECOND_PAGE;
}
else if(buttonNum - 2 == gMatrixIndex && SECOND_PAGE == gPageNum && FOUR_TIME_DAY == gSendType)
{
gPageNum = FIRST_PAGE;
}
update_send_time_msg(obj);
break;
case LV_USER_KEY_RIGHT:
gMatrixIndex = (gMatrixIndex + 2) % buttonNum;
printf("\033[33m[Option_send_time_Key]d gMatrixIndex = %d\033[0m\n", gMatrixIndex);
if(0 == gMatrixIndex && FIRST_PAGE == gPageNum && FOUR_TIME_DAY == gSendType)
{
gPageNum = SECOND_PAGE;
}
else if(0 == gMatrixIndex && SECOND_PAGE == gPageNum && FOUR_TIME_DAY == gSendType)
{
gPageNum = FIRST_PAGE;
}
update_send_time_msg(obj);
break;
case LV_KEY_ENTER:
printf("\033[33m[Option_send_time_Key]SELECT\033[0m\n");
// puiPara->WorkTime1Switch = 1;
memcpy(&(puiPara->TimeSend1), &gSendTime[0], sizeof(SF_PARA_TIME_S));
memcpy(&(puiPara->TimeSend2), &gSendTime[1], sizeof(SF_PARA_TIME_S));
memcpy(&(puiPara->TimeSend3), &gSendTime[2], sizeof(SF_PARA_TIME_S));
memcpy(&(puiPara->TimeSend4), &gSendTime[3], sizeof(SF_PARA_TIME_S));
lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0));
hidde_send_time_page();
break;
default:
break;
}
}

View File

@ -4,9 +4,20 @@
extern TM_MENU gSendMenu;
extern TM_ITEM gTM_ITEMS_SEND[];
enum SendType
{
ONCE_DAY = 1,
TWICE_DAY,
FOUR_TIME_DAY,
END
};
extern void show_MaxNum_page(lv_obj_t* obj);
extern void hidde_MaxNum_page(void);
extern void show_send_time_page(lv_obj_t* obj, const int sendType);
extern void hidde_send_time_page(void);
extern void Option_MaxNum_Key(lv_obj_t* obj, uint32_t key);
extern void Option_send_time_Key(lv_obj_t* obj, uint32_t key);
#endif

View File

@ -595,9 +595,13 @@ static void LV_MenuOption_OnSelected(lv_obj_t* obj)
pItem->ItemId == IDM_DELAY ||
pItem->ItemId == IDM_OPERATING_TIME ||
pItem->ItemId == IDM_DATE_AND_TIME ||
pItem->ItemId == IDM_MAX_NUM_DAY)
pItem->ItemId == IDM_MAX_NUM_DAY ||
pItem->ItemId == IDM_SEND_TYPE)
&& (pOption->TextId == IDS_CAMERA_NAME_ON ||
pOption->TextId == IDS_DATE_AND_TIME_MANUAL ||
pOption->TextId == IDS_SEND_TYPE_ONCE_DAY ||
pOption->TextId == IDS_SEND_TYPE_TWICE_DAY ||
pOption->TextId == IDS_SEND_TYPE_4_TIMES_DAY ||
pOption->TextId == IDS_MAX_NUM_DAY_NUMBER))
{
lv_obj_set_hidden(container_main_menu_scr_uiflowmenucommonoption, true);
@ -621,6 +625,10 @@ static void LV_MenuOption_OnSelected(lv_obj_t* obj)
break;
case IDM_MAX_NUM_DAY:
show_MaxNum_page(obj);
break;
case IDM_SEND_TYPE:
show_send_time_page(obj, SelOption);
break;
default:
break;
}
@ -918,7 +926,7 @@ void UIFlowMenuCommonOptionEventCallback(lv_obj_t* obj, lv_event_t event)
case IDM_SEND_TYPE:
if(isSetting)
{
// Option_Operating_Time_Key(obj, *key);
Option_send_time_Key(obj, *key);
}
else
{