diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/MenuGeneral.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/MenuGeneral.c index 7f6f36a75..dcb618696 100644 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/MenuGeneral.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/MenuGeneral.c @@ -706,12 +706,13 @@ void Option_Operating_Time_Key(lv_obj_t* obj, uint32_t key) // -------------------------------------------------------------------------- static int DateTimeIndex = 0; static lv_obj_t* DateTimeMatrixObj = NULL; -static char DateTimeMOBuf[3] = "00"; -static char DateTimeDDBuf[3] = "00"; -static char DateTimeYYBuf[5] = "0000"; -static char DateTimeHHBuf[3] = "00"; -static char DateTimeMIBuf[3] = "00"; -static char DateTimeSSBuf[3] = "00"; +static SF_PARA_TIME_S gDateTime; +static char DateTimeMOBuf[3] = {'0', '1', 0}; +static char DateTimeDDBuf[3] = {'0', '1', 0}; +static char DateTimeYYBuf[5] = {'2', '0', '2', '3', 0}; +static char DateTimeHHBuf[3] = {'0', '8', 0}; +static char DateTimeMIBuf[3] = {'0', '0', 0}; +static char DateTimeSSBuf[3] = {'0', '0', 0}; static const char* DateTimeMap[12] = { DateTimeMOBuf, @@ -731,6 +732,12 @@ static const char* DateTimeMap[12] = static void update_DateTime_Time_msg(lv_obj_t* obj) { // UIMenuStoreInfo *puiPara = sf_ui_para_get(); + snprintf(DateTimeMOBuf, 3, "%02d", gDateTime.Mon); + snprintf(DateTimeDDBuf, 3, "%02d", gDateTime.Day); + snprintf(DateTimeYYBuf, 5, "%04d", gDateTime.Year); + snprintf(DateTimeHHBuf, 3, "%02d", gDateTime.Hour); + snprintf(DateTimeMIBuf, 3, "%02d", gDateTime.Min); + snprintf(DateTimeSSBuf, 3, "%02d", gDateTime.Sec); lv_btnmatrix_set_focused_btn(DateTimeMatrixObj, DateTimeIndex); } @@ -741,23 +748,23 @@ void show_DateTime_page(lv_obj_t* obj) init_Matrix_style(); - UIMenuStoreInfo *puiPara = sf_ui_para_get(); - SF_PARA_TIME_S tmptime; - if(puiPara->DateAuto == SF_DATE_AUTO) + // UIMenuStoreInfo *puiPara = sf_ui_para_get(); + // SF_PARA_TIME_S tmptime; + // if(puiPara->DateAuto == SF_DATE_AUTO) { - tmptime.Year = 2023; - tmptime.Mon = 1; - tmptime.Day = 1; - tmptime.Hour = 8; - tmptime.Min = 0; - tmptime.Sec = 0; + gDateTime.Year = 2023; + gDateTime.Mon = 1; + gDateTime.Day = 1; + gDateTime.Hour = 8; + gDateTime.Min = 0; + gDateTime.Sec = 0; } - snprintf(DateTimeMOBuf, 3, "%02d", tmptime.Mon); - snprintf(DateTimeDDBuf, 3, "%02d", tmptime.Day); - snprintf(DateTimeYYBuf, 5, "%04d", tmptime.Year); - snprintf(DateTimeHHBuf, 3, "%02d", tmptime.Hour); - snprintf(DateTimeMIBuf, 3, "%02d", tmptime.Min); - snprintf(DateTimeSSBuf, 3, "%02d", tmptime.Sec); + snprintf(DateTimeMOBuf, 3, "%02d", gDateTime.Mon); + snprintf(DateTimeDDBuf, 3, "%02d", gDateTime.Day); + snprintf(DateTimeYYBuf, 5, "%04d", gDateTime.Year); + snprintf(DateTimeHHBuf, 3, "%02d", gDateTime.Hour); + snprintf(DateTimeMIBuf, 3, "%02d", gDateTime.Min); + snprintf(DateTimeSSBuf, 3, "%02d", gDateTime.Sec); DateTimeMatrixObj = lv_btnmatrix_create(obj, NULL); @@ -773,7 +780,7 @@ void show_DateTime_page(lv_obj_t* obj) lv_btnmatrix_set_one_check(DateTimeMatrixObj, false); lv_btnmatrix_set_btn_width(DateTimeMatrixObj, 0, 2); lv_btnmatrix_set_btn_width(DateTimeMatrixObj, 2, 2); - lv_btnmatrix_set_btn_width(DateTimeMatrixObj, 4, 3); + lv_btnmatrix_set_btn_width(DateTimeMatrixObj, 4, 4); lv_btnmatrix_set_btn_width(DateTimeMatrixObj, 6, 2); lv_btnmatrix_set_btn_width(DateTimeMatrixObj, 8, 2); lv_btnmatrix_set_btn_width(DateTimeMatrixObj, 10, 2); @@ -806,10 +813,94 @@ void Option_DateTime_Key(lv_obj_t* obj, uint32_t key) { case LV_USER_KEY_NEXT: printf("\033[33m[Option_DateTime_Key]s\033[0m\n"); + if(DateTimeIndex == 0) + { + if(gDateTime.Mon > 0 && gDateTime.Mon <= 12) + gDateTime.Mon--; + else + gDateTime.Mon = 12; + } + else if(DateTimeIndex == 2) + { + if(gDateTime.Day > 0 && gDateTime.Day <= 31) + gDateTime.Day--; + else + gDateTime.Day = 31; + } + else if(DateTimeIndex == 4) + { + if(gDateTime.Year > 0 && gDateTime.Year <= 4000) + gDateTime.Year--; + else + gDateTime.Year = 4000; + } + else if(DateTimeIndex == 6) + { + if(gDateTime.Hour > 0 && gDateTime.Hour <= 23) + gDateTime.Hour--; + else + gDateTime.Hour = 23; + } + else if(DateTimeIndex == 8) + { + if(gDateTime.Min > 0 && gDateTime.Min <= 59) + gDateTime.Min--; + else + gDateTime.Min = 59; + } + else if(DateTimeIndex == 10) + { + if(gDateTime.Sec > 0 && gDateTime.Sec <= 59) + gDateTime.Sec--; + else + gDateTime.Sec = 59; + } update_DateTime_Time_msg(obj); break; case LV_USER_KEY_PREV: printf("\033[33m[Option_DateTime_Key]w\033[0m\n"); + if(DateTimeIndex == 0) + { + if(gDateTime.Mon >= 12) + gDateTime.Mon = 0; + else + gDateTime.Mon++; + } + else if(DateTimeIndex == 2) + { + if(gDateTime.Day >= 31) + gDateTime.Day = 0; + else + gDateTime.Day++; + } + else if(DateTimeIndex == 4) + { + if(gDateTime.Year >= 4000) + gDateTime.Year = 0; + else + gDateTime.Year++; + } + else if(DateTimeIndex == 6) + { + if(gDateTime.Hour >= 23) + gDateTime.Hour = 0; + else + gDateTime.Hour++; + } + else if(DateTimeIndex == 8) + { + if(gDateTime.Min >= 59) + gDateTime.Min = 0; + else + gDateTime.Min++; + } + else if(DateTimeIndex == 10) + { + if(gDateTime.Sec >= 59) + gDateTime.Sec = 0; + else + gDateTime.Sec++; + } update_DateTime_Time_msg(obj); break; case LV_USER_KEY_LEFT: @@ -825,6 +916,7 @@ void Option_DateTime_Key(lv_obj_t* obj, uint32_t key) case LV_KEY_ENTER: printf("\033[33m[Option_DateTime_Key]SELECT\033[0m\n"); puiPara->DateAuto = SF_DATE_MANUAL; + sf_sys_rtc_time_set(&gDateTime); lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0)); hidde_DateTime_page(); break; diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/MenuSend.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/MenuSend.c index f7e5b78cc..1244f69d4 100644 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/MenuSend.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowMenuCommonItem/MenuSend.c @@ -501,7 +501,7 @@ void Option_send_time_Key(lv_obj_t* obj, uint32_t key) if(gSendTime[settingIndex + 0].Hour > 0 && gSendTime[settingIndex + 0].Hour <= 23) gSendTime[settingIndex + 0].Hour--; else - gSendTime[0].Hour = 23; + gSendTime[settingIndex + 0].Hour = 23; } else if(gMatrixIndex == 2) {