完善Operating Time功能及UI
This commit is contained in:
parent
d963512fe1
commit
3ca10087ad
|
@ -7,6 +7,7 @@
|
|||
#include "sf_systemMng.h"
|
||||
// #include "sf_commu_mcu_reg.h"
|
||||
#include "sf_common.h"
|
||||
#include <kwrap/debug.h>
|
||||
|
||||
TMDEF_BEGIN_OPTIONS(CAMERA_MODE)
|
||||
TMDEF_OPTION_TEXT_S(CAMERA_MODE_PHOTO, TM_OPTION_ENABLE)
|
||||
|
@ -168,7 +169,16 @@ int General_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
|
|||
}
|
||||
case IDM_OPERATING_TIME:
|
||||
{
|
||||
puiPara->WorkTime1Switch = uwOption == 0 ? SF_OFF : SF_ON;
|
||||
SF_ON_OFF tmpSelected = (uwOption == 0) ? SF_OFF : SF_ON;
|
||||
if(tmpSelected != puiPara->WorkTime1Switch)
|
||||
{
|
||||
puiPara->WorkTime[0].StartTime.Hour = 0;
|
||||
puiPara->WorkTime[0].StartTime.Min = 0;
|
||||
puiPara->WorkTime[0].StopTime.Hour = 0;
|
||||
puiPara->WorkTime[0].StopTime.Min = 0;
|
||||
puiPara->WorkTime1Switch = tmpSelected;
|
||||
}
|
||||
// puiPara->WorkTime1Switch = uwOption == 0 ? SF_OFF : SF_ON;
|
||||
break;
|
||||
}
|
||||
case IDM_FORMAT_SD:
|
||||
|
@ -652,6 +662,8 @@ void Option_Delay_Key(lv_obj_t* obj, uint32_t key)
|
|||
// --------------------------------------------------------------------------
|
||||
static int OperatingTimeIndex = 0;
|
||||
static lv_obj_t* OperatingTimeMatrixObj = NULL;
|
||||
static lv_obj_t* OperatingTimeImage = NULL;
|
||||
static lv_obj_t* OperatingTimeLabel = NULL;
|
||||
static char OperatingTimeHHBuf1[3] = "00";
|
||||
static char OperatingTimeMMBuf1[3] = "00";
|
||||
static char OperatingTimeHHBuf2[3] = "00";
|
||||
|
@ -670,31 +682,37 @@ static const char* OperatingTimeMap[8] =
|
|||
|
||||
static void update_Operating_Time_msg(lv_obj_t* obj)
|
||||
{
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
if(OperatingTimeMatrixObj == NULL || OperatingTimeImage == NULL)
|
||||
{
|
||||
DBG_ERR("Password component is not initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
snprintf(OperatingTimeHHBuf1, 3, "%02d", puiPara->WorkTime[0].StartTime.Hour);
|
||||
snprintf(OperatingTimeMMBuf1, 3, "%02d", puiPara->WorkTime[0].StartTime.Min);
|
||||
snprintf(OperatingTimeHHBuf2, 3, "%02d", puiPara->WorkTime[0].StopTime.Hour);
|
||||
snprintf(OperatingTimeMMBuf2, 3, "%02d", puiPara->WorkTime[0].StopTime.Min);
|
||||
lv_btnmatrix_set_map(OperatingTimeMatrixObj, OperatingTimeMap);
|
||||
|
||||
lv_btnmatrix_set_focused_btn(OperatingTimeMatrixObj, OperatingTimeIndex);
|
||||
lv_btnmatrix_set_map(OperatingTimeMatrixObj, OperatingTimeMap);
|
||||
|
||||
lv_obj_set_x(OperatingTimeImage, (72 + ((32 + 16) / 2) * OperatingTimeIndex));
|
||||
}
|
||||
|
||||
void show_Operating_Time_page(lv_obj_t* obj)
|
||||
{
|
||||
if(OperatingTimeMatrixObj != NULL || OperatingTimeImage != NULL || OperatingTimeLabel != NULL)
|
||||
{
|
||||
DBG_ERR("Password component is initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
OperatingTimeIndex = 0;
|
||||
|
||||
init_Matrix_style();
|
||||
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
// if(!puiPara->WorkTime1Switch)
|
||||
{
|
||||
puiPara->WorkTime[0].StartTime.Hour = 0;
|
||||
puiPara->WorkTime[0].StartTime.Min = 0;
|
||||
puiPara->WorkTime[0].StopTime.Hour = 0;
|
||||
puiPara->WorkTime[0].StopTime.Min = 0;
|
||||
}
|
||||
snprintf(OperatingTimeHHBuf1, 3, "%02d", puiPara->WorkTime[0].StartTime.Hour);
|
||||
snprintf(OperatingTimeMMBuf1, 3, "%02d", puiPara->WorkTime[0].StartTime.Min);
|
||||
snprintf(OperatingTimeHHBuf2, 3, "%02d", puiPara->WorkTime[0].StopTime.Hour);
|
||||
|
@ -704,41 +722,147 @@ void show_Operating_Time_page(lv_obj_t* obj)
|
|||
lv_obj_set_hidden(OperatingTimeMatrixObj, false);
|
||||
lv_obj_set_click(OperatingTimeMatrixObj, true);
|
||||
lv_obj_set_drag(OperatingTimeMatrixObj, false);
|
||||
lv_obj_set_pos(OperatingTimeMatrixObj, 65, 58);
|
||||
lv_obj_set_size(OperatingTimeMatrixObj, 190, 140);
|
||||
lv_obj_set_pos(OperatingTimeMatrixObj, 72, 108);
|
||||
lv_obj_set_size(OperatingTimeMatrixObj, 176, 24);
|
||||
lv_btnmatrix_set_map(OperatingTimeMatrixObj, OperatingTimeMap);
|
||||
lv_btnmatrix_set_one_check(OperatingTimeMatrixObj, true);
|
||||
lv_btnmatrix_set_align(OperatingTimeMatrixObj, LV_LABEL_ALIGN_CENTER);
|
||||
lv_btnmatrix_set_focused_btn(OperatingTimeMatrixObj,0);
|
||||
lv_btnmatrix_set_one_check(OperatingTimeMatrixObj, false);
|
||||
lv_btnmatrix_set_btn_width(OperatingTimeMatrixObj, 0, 2);
|
||||
lv_btnmatrix_set_btn_width(OperatingTimeMatrixObj, 2, 2);
|
||||
lv_btnmatrix_set_btn_width(OperatingTimeMatrixObj, 4, 2);
|
||||
lv_btnmatrix_set_btn_width(OperatingTimeMatrixObj, 6, 2);
|
||||
lv_obj_add_style(OperatingTimeMatrixObj, 0, &gMatrixStylebg);
|
||||
lv_obj_add_style(OperatingTimeMatrixObj, 1, &gMatrixStylebtn);
|
||||
|
||||
OperatingTimeImage = lv_img_create(obj, NULL);
|
||||
lv_obj_set_hidden(OperatingTimeImage, false);
|
||||
lv_obj_set_click(OperatingTimeImage, false);
|
||||
lv_obj_set_drag(OperatingTimeImage, false);
|
||||
lv_obj_set_pos(OperatingTimeImage, 72, 78);
|
||||
lv_obj_set_size(OperatingTimeImage, 32, 88);
|
||||
lv_img_set_src(OperatingTimeImage, &sf_pwd_down_up);
|
||||
|
||||
OperatingTimeLabel = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(OperatingTimeLabel, "HH : MM HH : MM");
|
||||
lv_label_set_align(OperatingTimeLabel, LV_LABEL_ALIGN_CENTER);
|
||||
lv_obj_set_pos(OperatingTimeLabel, 76, 155);
|
||||
lv_obj_set_size(OperatingTimeLabel, 176, 21);
|
||||
lv_obj_add_style(OperatingTimeLabel, 0, &gStyleLabel0);
|
||||
}
|
||||
|
||||
void hidde_Operating_Time_page(void)
|
||||
{
|
||||
printf("[%s]\n", __FUNCTION__);
|
||||
OperatingTimeIndex = 0;
|
||||
if(OperatingTimeMatrixObj)
|
||||
{
|
||||
lv_obj_del(OperatingTimeMatrixObj);
|
||||
OperatingTimeMatrixObj = NULL;
|
||||
}
|
||||
if(OperatingTimeImage)
|
||||
{
|
||||
lv_obj_del(OperatingTimeImage);
|
||||
OperatingTimeImage = NULL;
|
||||
}
|
||||
if(OperatingTimeLabel)
|
||||
{
|
||||
lv_obj_del(OperatingTimeLabel);
|
||||
OperatingTimeLabel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Option_Operating_Time_Key(lv_obj_t* obj, uint32_t key)
|
||||
void Option_Operating_Time_Key_Long_Press(lv_obj_t* obj, uint32_t key)
|
||||
{
|
||||
if(OperatingTimeMatrixObj == NULL)
|
||||
{
|
||||
printf("OperatingTimeMatrixObj is NULL");
|
||||
return;
|
||||
}
|
||||
printf("[%s]key:%d\n", __FUNCTION__, key);
|
||||
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case LV_USER_KEY_NEXT:
|
||||
if(OperatingTimeIndex == 0)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StartTime.Hour > 0 && puiPara->WorkTime[0].StartTime.Hour <= 23)
|
||||
puiPara->WorkTime[0].StartTime.Hour--;
|
||||
else
|
||||
puiPara->WorkTime[0].StartTime.Hour = 23;
|
||||
}
|
||||
else if(OperatingTimeIndex == 2)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StartTime.Min > 0 && puiPara->WorkTime[0].StartTime.Min <= 59)
|
||||
puiPara->WorkTime[0].StartTime.Min--;
|
||||
else
|
||||
puiPara->WorkTime[0].StartTime.Min = 59;
|
||||
}
|
||||
else if(OperatingTimeIndex == 4)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StopTime.Hour > 0 && puiPara->WorkTime[0].StopTime.Hour <= 23)
|
||||
puiPara->WorkTime[0].StopTime.Hour--;
|
||||
else
|
||||
puiPara->WorkTime[0].StopTime.Hour = 23;
|
||||
}
|
||||
else if(OperatingTimeIndex == 6)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StopTime.Min > 0 && puiPara->WorkTime[0].StopTime.Min <= 59)
|
||||
puiPara->WorkTime[0].StopTime.Min--;
|
||||
else
|
||||
puiPara->WorkTime[0].StopTime.Min = 59;
|
||||
}
|
||||
update_Operating_Time_msg(obj);
|
||||
break;
|
||||
case LV_USER_KEY_PREV:
|
||||
if(OperatingTimeIndex == 0)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StartTime.Hour >= 23)
|
||||
puiPara->WorkTime[0].StartTime.Hour = 0;
|
||||
else
|
||||
puiPara->WorkTime[0].StartTime.Hour++;
|
||||
}
|
||||
else if(OperatingTimeIndex == 2)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StartTime.Min >= 59)
|
||||
puiPara->WorkTime[0].StartTime.Min = 0;
|
||||
else
|
||||
puiPara->WorkTime[0].StartTime.Min++;
|
||||
}
|
||||
else if(OperatingTimeIndex == 4)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StopTime.Hour >= 23)
|
||||
puiPara->WorkTime[0].StopTime.Hour = 0;
|
||||
else
|
||||
puiPara->WorkTime[0].StopTime.Hour++;
|
||||
}
|
||||
else if(OperatingTimeIndex == 6)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StopTime.Min >= 59)
|
||||
puiPara->WorkTime[0].StopTime.Min = 0;
|
||||
else
|
||||
puiPara->WorkTime[0].StopTime.Min++;
|
||||
}
|
||||
update_Operating_Time_msg(obj);
|
||||
break;
|
||||
case LV_USER_KEY_LEFT:
|
||||
break;
|
||||
case LV_USER_KEY_RIGHT:
|
||||
break;
|
||||
case LV_KEY_ENTER:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Option_Operating_Time_Key(lv_obj_t* obj, uint32_t key)
|
||||
{
|
||||
printf("[%s]key:%d\n", __FUNCTION__, key);
|
||||
|
||||
// char result[2];
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
printf("key:%d\n",key);
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case LV_USER_KEY_NEXT:
|
||||
printf("\033[33m[Option_Operating_Time_Key]s\033[0m\n");
|
||||
if(OperatingTimeIndex == 0)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StartTime.Hour > 0 && puiPara->WorkTime[0].StartTime.Hour <= 23)
|
||||
|
@ -770,7 +894,6 @@ void Option_Operating_Time_Key(lv_obj_t* obj, uint32_t key)
|
|||
update_Operating_Time_msg(obj);
|
||||
break;
|
||||
case LV_USER_KEY_PREV:
|
||||
printf("\033[33m[Option_Operating_Time_Key]w\033[0m\n");
|
||||
if(OperatingTimeIndex == 0)
|
||||
{
|
||||
if(puiPara->WorkTime[0].StartTime.Hour >= 23)
|
||||
|
@ -802,17 +925,14 @@ void Option_Operating_Time_Key(lv_obj_t* obj, uint32_t key)
|
|||
update_Operating_Time_msg(obj);
|
||||
break;
|
||||
case LV_USER_KEY_LEFT:
|
||||
printf("\033[33m[Option_Operating_Time_Key]a\033[0m\n");
|
||||
OperatingTimeIndex = (OperatingTimeIndex - 2 + 8) % 8;
|
||||
update_Operating_Time_msg(obj);
|
||||
break;
|
||||
case LV_USER_KEY_RIGHT:
|
||||
printf("\033[33m[Option_Operating_Time_Key]d\033[0m\n");
|
||||
OperatingTimeIndex = (OperatingTimeIndex + 2) % 8;
|
||||
update_Operating_Time_msg(obj);
|
||||
break;
|
||||
case LV_KEY_ENTER:
|
||||
printf("\033[33m[Option_Operating_Time_Key]SELECT\033[0m\n");
|
||||
puiPara->WorkTime1Switch = 1;
|
||||
lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0));
|
||||
hidde_Operating_Time_page();
|
||||
|
|
|
@ -23,6 +23,7 @@ extern void hidde_DateTime_page(void);
|
|||
extern void Option_Sensitivity_Key(lv_obj_t* obj, uint32_t key);
|
||||
extern void Option_Delay_Key(lv_obj_t* obj, uint32_t key);
|
||||
extern void Option_Operating_Time_Key(lv_obj_t* obj, uint32_t key);
|
||||
extern void Option_Operating_Time_Key_Long_Press(lv_obj_t* obj, uint32_t key);
|
||||
extern void Option_DateTime_Key(lv_obj_t* obj, uint32_t key);
|
||||
|
||||
extern unsigned int get_dig_pir_level(void);
|
||||
|
|
|
@ -1034,7 +1034,6 @@ void show_Camera_Info_page(lv_obj_t* obj)
|
|||
static lv_style_t LabelStyle = {0};
|
||||
lv_style_init(&LabelStyle);
|
||||
lv_style_copy(&LabelStyle, &gStyleLabel0);
|
||||
lv_style_set_text_font(&LabelStyle,LV_STATE_DEFAULT,&sf_ui_text_medium_18_8bpp);
|
||||
lv_style_set_text_line_space(&LabelStyle, LV_STATE_DEFAULT, -2);
|
||||
CameraInfolabel = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(CameraInfolabel, "");
|
||||
|
|
|
@ -847,7 +847,8 @@ void UIFlowMenuCommonOptionEventCallback(lv_obj_t* obj, lv_event_t event)
|
|||
{
|
||||
case IDM_PASSWORD:
|
||||
KeyPressingTimeMs += LONG_PRESS_INTERVAL;
|
||||
Option_Password_Key_Long_Press(obj, *key);
|
||||
if(KeyPressingTimeMs > 1 * 1000)
|
||||
Option_Password_Key_Long_Press(obj, *key);
|
||||
break;
|
||||
case IDM_CAMERA_INFO:
|
||||
KeyPressingTimeMs += LONG_PRESS_INTERVAL;
|
||||
|
@ -856,7 +857,13 @@ void UIFlowMenuCommonOptionEventCallback(lv_obj_t* obj, lv_event_t event)
|
|||
break;
|
||||
case IDM_CAMERA_NAME:
|
||||
KeyPressingTimeMs += LONG_PRESS_INTERVAL;
|
||||
Option_Camera_Name_Key_Long_Press(obj, *key);
|
||||
if(KeyPressingTimeMs > 1 * 1000)
|
||||
Option_Camera_Name_Key_Long_Press(obj, *key);
|
||||
break;
|
||||
case IDM_OPERATING_TIME:
|
||||
KeyPressingTimeMs += LONG_PRESS_INTERVAL;
|
||||
if(KeyPressingTimeMs > 1 * 1000)
|
||||
Option_Operating_Time_Key_Long_Press(obj, *key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user