Fixed check sim show bug.

This commit is contained in:
xiaojiazhu 2023-11-24 17:38:03 +08:00
parent b99d29fb10
commit c03e1abcc0
3 changed files with 76 additions and 13 deletions

View File

@ -432,8 +432,63 @@ static void signal_icon_show(const short signal)
break; break;
} }
} }
void set_warning_label_text(lv_obj_t* obj)
{
lv_color_t color = {0};
static lv_style_t label_tips_s0;
lv_style_init(&label_tips_s0);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_tips_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_tips_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_tips_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x26, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_tips_s0, LV_STATE_DEFAULT, color);
lv_style_set_text_font(&label_tips_s0,LV_STATE_DEFAULT,&sf_ui_text_medium_16_1bpp);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&label_tips_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_tips_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_tips_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_tips_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_tips_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x26, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_tips_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&label_tips_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_tips_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_tips_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_tips_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_tips_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_tips_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&label_tips_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_tips_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_tips_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_tips_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_tips_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_tips_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&label_tips_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_tips_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_tips_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_tips_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_tips_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_tips_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&label_tips_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_tips_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_tips_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_tips_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_tips_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_tips_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&label_tips_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_tips_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_tips_s0, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_tips_s0, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_tips_s0, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_tips_s0, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&label_tips_s0, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_tips_s0, LV_STATE_DISABLED, color);
lv_obj_add_style(obj, 0, &label_tips_s0);
}
static void update_4g_module_icon(void) static void update_4g_module_icon(void)
{ {
#define NO_SIM_CARD 0
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;
UIMenuStoreInfo *puiPara = sf_ui_para_get(); UIMenuStoreInfo *puiPara = sf_ui_para_get();
static short signal = SIGNAL_NOT_YET_GET; static short signal = SIGNAL_NOT_YET_GET;
static short searching_index = -1; static short searching_index = -1;
@ -446,21 +501,33 @@ static void update_4g_module_icon(void)
signal_icon_hidden(searching_index); signal_icon_hidden(searching_index);
searching_index++; searching_index++;
searching_index = searching_index % 5; searching_index = searching_index % 5;
//printf(" searching ... [%d]\n", searching_index); // printf(" searching ... [%d]\n", searching_index);
signal_icon_show(searching_index); signal_icon_show(searching_index);
} }
else if(signal != signal_new) else if(signal != signal_new && SIM_CARD_NOT_INIT != puiPara->NetGeneration)
{ {
lv_obj_set_hidden(label_tips_scr_uiflowphoto, true);
// Update the icon. // Update the icon.
printf("old signal = %d new signal = %d\n", signal, signal_new); printf("old signal = %d new signal = %d signal_level = %d\n", signal, signal_new, signal_level);
lv_obj_set_hidden(label_sim_scr_uiflowphoto, true); lv_obj_set_hidden(label_sim_scr_uiflowphoto, true);
signal_icon_hidden(searching_index); signal_icon_hidden(searching_index);
signal_icon_hidden(signal); signal_icon_hidden(signal);
signal_icon_show(signal_level); signal_icon_show(signal_level);
signal = signal_new; signal = signal_new;
} }
else // else if (sf_cardv_get_sim_insert() == NO_SIM_CARD)
else if (SIM_CARD_NOT_INIT == puiPara->NetGeneration)
{ {
signal_icon_hidden(0);
signal_icon_hidden(1);
signal_icon_hidden(2);
signal_icon_hidden(3);
signal_icon_hidden(4);
lv_obj_set_hidden(label_tips_scr_uiflowphoto, false);
set_warning_label_text(label_tips_scr_uiflowphoto);
lv_label_set_text(label_tips_scr_uiflowphoto,"Check Sim");
lv_obj_set_hidden(label_sim_scr_uiflowphoto, true);
} else {
// Nothing changed. // Nothing changed.
// printf(" nothing changed.\n"); // printf(" nothing changed.\n");
} }
@ -481,10 +548,6 @@ const int EMPTY_IMAGE = 0;
LV_PLUGIN_IMG_ID_SF_NET4G LV_PLUGIN_IMG_ID_SF_NET4G
}; };
// printf("NetGeneration:%d\n", puiPara->NetGeneration); // 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 // puiPara->NetGeneration = NET_GENERATION_4G; // Test
if (SIM_CARD_NOT_INIT == puiPara->NetGeneration if (SIM_CARD_NOT_INIT == puiPara->NetGeneration
|| puiPara->NetGeneration < NET_GENERATION_2G || puiPara->NetGeneration < NET_GENERATION_2G

View File

@ -113,8 +113,8 @@ BOOL sf_is_preview(void);
short sf_cardv_get_cq_signal(void); short sf_cardv_get_cq_signal(void);
void sf_cardv_4G_status_set(UINT8 status); void sf_cardv_4G_status_set(UINT8 status);
UINT8 sf_cardv_4G_status_get(void); UINT8 sf_cardv_4G_status_get(void);
void sf_cardv_set_sim_insert(UINT8 sim); void sf_cardv_set_sim_insert(INT8 sim);
UINT8 sf_cardv_get_sim_insert(void); INT8 sf_cardv_get_sim_insert(void);
void sf_cardv_set_is_esim(int flag); void sf_cardv_set_is_esim(int flag);
UINT8 sf_cardv_get_is_esim(void); UINT8 sf_cardv_get_is_esim(void);
void sf_cardv_set_operationSelectResp(UINT8 resp); void sf_cardv_set_operationSelectResp(UINT8 resp);

View File

@ -71,7 +71,7 @@ UINT16 AutoOfftime = 0;
static unsigned int KeepAliveTime_s = DEFAULT_GO_TO_WORK_MODE_TIME_S; static unsigned int KeepAliveTime_s = DEFAULT_GO_TO_WORK_MODE_TIME_S;
BOOL isGoing2Pir = FALSE; BOOL isGoing2Pir = FALSE;
static UINT8 NetWorkFlag = 0; //SF_4G_STATUS_E static UINT8 NetWorkFlag = 0; //SF_4G_STATUS_E
static UINT8 simCardInsert = 0; static INT8 simCardInsert = -1;
static int g_esim_flag = 0; static int g_esim_flag = 0;
static UINT8 operationSelectResp = 0; //WIFICameraErrCode_t static UINT8 operationSelectResp = 0; //WIFICameraErrCode_t
UINT8 RtspFlag = 0; UINT8 RtspFlag = 0;
@ -2552,13 +2552,13 @@ UINT8 sf_cardv_4G_status_get(void)
return NetWorkFlag; return NetWorkFlag;
} }
void sf_cardv_set_sim_insert(UINT8 sim) void sf_cardv_set_sim_insert(INT8 sim)
{ {
simCardInsert = sim; simCardInsert = sim;
printf("cardv simCardInsert:%d\n",simCardInsert); printf("cardv simCardInsert:%d\n",simCardInsert);
} }
UINT8 sf_cardv_get_sim_insert(void) INT8 sf_cardv_get_sim_insert(void)
{ {
return simCardInsert; return simCardInsert;
} }