Improve preview screen.

This commit is contained in:
xiaojiazhu 2023-10-17 11:41:12 +08:00
parent b1176dc336
commit 0d64183720
2 changed files with 140 additions and 12 deletions

View File

@ -9,6 +9,7 @@
#include "DCF.h"
#endif
#include "sf_wifi_svr.h"
#if HUNTING_CAMERA_MCU == ENABLE
#include <sf_inc.h>
#endif
@ -338,6 +339,56 @@ static void update_rec_time(void)
lv_label_set_text_fmt(label_rec_time_scr_uiflowmovie, "%02d:%02d:%02d", rec_sec / 3600, (rec_sec % 3600) / 60, (rec_sec % 3600) % 60);
}
static void update_wifi(void)
{
const int EMPTY_IMAGE = 0;
SF_WIFI_STATUS_E status = sf_get_wifi_status();
lv_plugin_res_id res[] = {
EMPTY_IMAGE,
LV_PLUGIN_IMG_ID_SF_WIFI_UNCONNECTED,
LV_PLUGIN_IMG_ID_SF_WIFI_CONNECTED,
LV_PLUGIN_IMG_ID_SF_WIFI_UNSUPPORT
};
const int WIFI_NOT_INIT = 0;
const int WIFI_UNCONNECTED = 1;
const int WIFI_UNSUPPORT = 3;
if (WIFI_NOT_INIT == status
|| status < WIFI_UNCONNECTED
|| status > WIFI_UNSUPPORT)
{
lv_obj_set_hidden(image_wifi_connected_scr_uiflowmovie, true);
return;
}
int index = status;
lv_obj_set_hidden(image_wifi_connected_scr_uiflowmovie, false);
lv_plugin_img_set_src(image_wifi_connected_scr_uiflowmovie, res[index]);
}
static void update_bluetooth(void)
{
const int EMPTY_IMAGE = 0;
SF_WIFI_STATUS_E status = sf_get_wifi_status();
lv_plugin_res_id res[] = {
EMPTY_IMAGE,
LV_PLUGIN_IMG_ID_SF_BLUETOOTH_UNCONNECTED,
LV_PLUGIN_IMG_ID_SF_BLUETOOTH_CONNECTED,
LV_PLUGIN_IMG_ID_SF_BLUETOOTH_UNSUPPORT
};
const int WIFI_NOT_INIT = 0;
const int WIFI_UNCONNECTED = 1;
const int WIFI_UNSUPPORT = 3;
if (WIFI_NOT_INIT == status
|| status < WIFI_UNCONNECTED
|| status > WIFI_UNSUPPORT)
{
lv_obj_set_hidden(image_bluetooth_connected_scr_uiflowmovie, true);
return;
}
int index = status;
lv_obj_set_hidden(image_bluetooth_connected_scr_uiflowmovie, false);
lv_plugin_img_set_src(image_bluetooth_connected_scr_uiflowmovie, res[index]);
}
static void update_size(void)
{
lv_label_set_text(label_size_scr_uiflowmovie, resolution_Buf[SysGetFlag(FL_MOVIE_SIZE)]);
@ -445,16 +496,16 @@ static void update_card(void)
}
}
static void update_wifi(void)
{
static lv_plugin_res_id res[] = {
LV_PLUGIN_IMG_ID_ICON_WIFI_OFF,
LV_PLUGIN_IMG_ID_ICON_WIFI_ON,
LV_PLUGIN_IMG_ID_ICON_CLOUD_ON,
};
// static void update_wifi(void)
// {
// static lv_plugin_res_id res[] = {
// LV_PLUGIN_IMG_ID_ICON_WIFI_OFF,
// LV_PLUGIN_IMG_ID_ICON_WIFI_ON,
// LV_PLUGIN_IMG_ID_ICON_CLOUD_ON,
// };
lv_plugin_img_set_src(image_wifi_scr_uiflowmovie, res[SysGetFlag(FL_WIFI)]);
}
// lv_plugin_img_set_src(image_wifi_scr_uiflowmovie, res[SysGetFlag(FL_WIFI)]);
// }
static void update_icons(void)
@ -465,7 +516,6 @@ static void update_icons(void)
update_size();
update_ev();
update_card();
update_wifi();
update_hdr();
update_motionDet();
update_cyclic_rec();
@ -473,7 +523,8 @@ static void update_icons(void)
update_max_rec_time();
update_4g_module_icon();
update_camera_message();
update_wifi();
update_bluetooth();
}
static void UIFlowMovie_MotionDetect(void)

View File

@ -14,7 +14,7 @@
#include "exif/Exif.h"
#include <kwrap/util.h>
#include "SysMain.h"
#include "sf_wifi_svr.h"
#if (USE_DCF == ENABLE)
#include "DCF.h"
#endif
@ -373,7 +373,32 @@ static void update_4g_module_icon(void)
{
// Nothing changed.
// printf(" nothing changed.\n");
}
const int EMPTY_IMAGE = 0;
UIMenuStoreInfo *puiPara = sf_ui_para_get();
lv_plugin_res_id res[] = {
EMPTY_IMAGE,
EMPTY_IMAGE,
LV_PLUGIN_IMG_ID_SF_NET2G,
LV_PLUGIN_IMG_ID_SF_NET3G,
LV_PLUGIN_IMG_ID_SF_NET4G
};
// printf("NetGeneration:%d\n", puiPara->NetGeneration);
const int SIM_CARD_NOT_INIT = 0;
const int NET_GENERATION_2G = 2;
// const int NET_GENERATION_3G = 3;
const int NET_GENERATION_4G = 4;
// puiPara->NetGeneration = NET_GENERATION_4G; // Test
if (SIM_CARD_NOT_INIT == puiPara->NetGeneration
|| puiPara->NetGeneration < NET_GENERATION_2G
|| puiPara->NetGeneration > NET_GENERATION_4G)
{
lv_obj_set_hidden(image_4g_scr_uiflowphoto, true);
return;
}
int index = puiPara->NetGeneration;
lv_obj_set_hidden(image_4g_scr_uiflowphoto, false);
lv_plugin_img_set_src(image_4g_scr_uiflowphoto, res[index]);
}
static void update_camera_message(void)
@ -421,6 +446,56 @@ static void update_camera_message(void)
}
}
static void update_wifi(void)
{
const int EMPTY_IMAGE = 0;
SF_WIFI_STATUS_E status = sf_get_wifi_status();
lv_plugin_res_id res[] = {
EMPTY_IMAGE,
LV_PLUGIN_IMG_ID_SF_WIFI_UNCONNECTED,
LV_PLUGIN_IMG_ID_SF_WIFI_CONNECTED,
LV_PLUGIN_IMG_ID_SF_WIFI_UNSUPPORT
};
const int WIFI_NOT_INIT = 0;
const int WIFI_UNCONNECTED = 1;
const int WIFI_UNSUPPORT = 3;
if (WIFI_NOT_INIT == status
|| status < WIFI_UNCONNECTED
|| status > WIFI_UNSUPPORT)
{
lv_obj_set_hidden(image_wifi_connected_scr_uiflowphoto, true);
return;
}
int index = status;
lv_obj_set_hidden(image_wifi_connected_scr_uiflowphoto, false);
lv_plugin_img_set_src(image_wifi_connected_scr_uiflowphoto, res[index]);
}
static void update_bluetooth(void)
{
const int EMPTY_IMAGE = 0;
SF_WIFI_STATUS_E status = sf_get_wifi_status();
lv_plugin_res_id res[] = {
EMPTY_IMAGE,
LV_PLUGIN_IMG_ID_SF_BLUETOOTH_UNCONNECTED,
LV_PLUGIN_IMG_ID_SF_BLUETOOTH_CONNECTED,
LV_PLUGIN_IMG_ID_SF_BLUETOOTH_UNSUPPORT
};
const int WIFI_NOT_INIT = 0;
const int WIFI_UNCONNECTED = 1;
const int WIFI_UNSUPPORT = 3;
if (WIFI_NOT_INIT == status
|| status < WIFI_UNCONNECTED
|| status > WIFI_UNSUPPORT)
{
lv_obj_set_hidden(image_bluetooth_connected_scr_uiflowphoto, true);
return;
}
int index = status;
lv_obj_set_hidden(image_bluetooth_connected_scr_uiflowphoto, false);
lv_plugin_img_set_src(image_bluetooth_connected_scr_uiflowphoto, res[index]);
}
static void update_fd_frame(void)
{
if (SysGetFlag(FL_FD) != FD_OFF){
@ -458,6 +533,8 @@ static void update_icons(void)
update_dzoom();
update_4g_module_icon();
update_camera_message();
update_wifi();
update_bluetooth();
}
static void FlowPhoto_InitStartupFuncs(void)