From c5f3229efef50c5c7e36e9ac1427d3f66a0d3631 Mon Sep 17 00:00:00 2001 From: payton Date: Thu, 9 Nov 2023 19:08:59 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96utc=E3=80=81ntp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/source/4gMng/sf_eg91_sim.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c b/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c index 958501b15..4127e3e96 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c @@ -4728,8 +4728,9 @@ SINT32 sf_get_utc(VOID) strcpy((char *)gsmPara, "AT+QLTS=2\r"); ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara)); SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE); - ttyData.cmp = "OK"; + ttyData.cmp = "+QLTS:"; ttyData.len = 48; + sf_sleep_ms(200); } } @@ -4800,6 +4801,8 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) SF_TTY_DATA_TYPE_S ttyData = { .waitMs = 1000, .len = 3, .lenMax = (GPRS_INFO_LINE_MAX-1), .cmp = "OK", .cmperr = "ERROR", .data = gsmPara}; SF_DEBUG("Sim4gApn=%s", pPara->Sim4gApn); + + sf_hal_ttyusb2_read(gsmPara, 200);//clean uart read buff sf_gsm_para_buff_clear(); pdpIndex = sf_get_pdp_index(); @@ -4937,7 +4940,7 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) } else { - if(calltime > 350) + if(calltime > 50) { ret = SF_SIM_ERROR_NTP; sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X;gsmPara:%s", __FUNCTION__, __LINE__, ret, strstr((const char *)gsmPara, "ERROR")); @@ -4971,7 +4974,7 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) case SMS_SIM_INIT_EXIT: - if(strstr((const char *)gsmPara, "OK") || (calltime > 300)) + if(strstr((const char *)gsmPara, "OK") || (calltime > 100)) { goto SF_GEN_NTP_END; } @@ -4993,7 +4996,7 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) time++; - if(time > 800) + if(time > 200) { SLOGE(gsmPara); sprintf((char *)logStr, "[%s:%d]Wait Init Timeout.", __FUNCTION__, __LINE__);