From 9298533d21b4527cd7e07e17815f467e5ae1229b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=AD=99=E6=98=A5=E9=98=B3?= Date: Mon, 27 Apr 2026 22:02:17 +0800 Subject: [PATCH] =?utf8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0AT^LN=5FSTART=5FOTA?= =?utf8?q?=5FCAT1=20=E9=80=9A=E8=BF=87=E7=A0=94=E5=8F=91=E6=B5=8B=E8=AF=95?= =?utf8?q?=E6=9C=8D=E4=B8=8B=E8=BD=BDcat1=20ota=202=E3=80=81=E9=BB=98?= =?utf8?q?=E8=AE=A4=E5=85=B3=E9=97=ADuart=20flow=20ctl=203=E3=80=81release?= =?utf8?q?=20V1.0.47=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- autobuild.sh | 2 +- .../config/target_config/brandy/config.py | 2 +- .../zhihui/leiniao/imsl_ln/leiniao_api_at.c | 65 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index f44e015e1..089cd3d83 100644 --- a/autobuild.sh +++ b/autobuild.sh @@ -59,7 +59,7 @@ declare -A PROJECT_VERSIONS=( ["w9"]="1.3.107" ["lt22"]="1.3.107" ["n9"]="1.3.113" - ["ln"]="1.0.46" + ["ln"]="1.0.47" ["lnppp"]="1.1.1" ["n9ln"]="1.0.0" diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index aa9180080..0e2032cf9 100644 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -1314,7 +1314,7 @@ target = { 'AUDIO_SMARTPA_AW88082', 'LCD_JD9885', 'SUPPORT_LEINIAO', - # 'SIO_UART_DISABLE_FLOW_CTRL', + 'SIO_UART_DISABLE_FLOW_CTRL', ], #添加自定义应用 'ram_component': [ diff --git a/code/sdk/zhihui/leiniao/imsl_ln/leiniao_api_at.c b/code/sdk/zhihui/leiniao/imsl_ln/leiniao_api_at.c index 798f7f9a5..d032de00f 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/leiniao_api_at.c +++ b/code/sdk/zhihui/leiniao/imsl_ln/leiniao_api_at.c @@ -267,6 +267,69 @@ static uint32_t ln_ota_get_task_new_cat1_at(uint8_t *para, uint32_t paraLen, cha return ERRCODE_SUCC; } +/* 提取modem固件版本号(前缀+最后4位) */ +static int get_modem_fw_version_c(const char* input_str, char* output_str) +{ + if (input_str == NULL || strlen(input_str) == 0 || output_str == NULL) { + return -1; + } + + memset(output_str, 0, 16); + + // 提取字符串最后4位 + char suffix_4[5] = {0}; + int input_len = strlen(input_str); + int suffix_start = (input_len >= 4) ? (input_len - 4) : 0; + strncpy(suffix_4, input_str + suffix_start, 4); + suffix_4[4] = '\0'; + + // 判断前缀并拼接版本号 + if (strstr(input_str, "EG800AK") != NULL) { + strcpy(output_str, "EG8AK"); + strcat(output_str, suffix_4); + } else if (strstr(input_str, "EG810") != NULL) { + strcpy(output_str, "EG810"); + strcat(output_str, suffix_4); + } else { + return -1; + } + return 0; +} +static uint32_t ln_otca_cat1_at(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + LN_UNUSED(para); + LN_UNUSED(paraLen); + LN_UNUSED(strCommonCmd); + printf("[LN][OTA_GET_TASK_NEW]\n"); + + const char *dfota_url_format = "http://snicker.com.cn:8089/leiniao/%s/dfota_%d.bin"; + char dfota1_url[128] = {0}; + char dfota2_url[128] = {0}; + // 直接获取CAT1 modem版本(如果版本还未获取,会在后续处理中处理) + char *text = cat1_api_runtime_get_cat1_modemver(); + if (!text || strlen(text) == 0) { + printf("[OTA] cat1 modem版本为空,执行普通OTA升级\n"); + } + + char version[16] = {0}; + if (get_modem_fw_version_c(text, version) != 0) { + printf("[OTA] 无法解析modem版本,执行普通OTA升级\n"); + } + + printf("[OTA] Modem固件版本: %s\n", version); + + // 构建版本字符串 + char version1_str[64] = {0}; + uint8_t ver = uapi_get_py_ver(); + snprintf(version1_str, sizeof(version1_str), "%sV%d", version, ver); + snprintf(dfota1_url, sizeof(dfota1_url), dfota_url_format, version1_str, 1); + snprintf(dfota2_url, sizeof(dfota2_url), dfota_url_format, version1_str, 2); + printf("[OTA] url1: %s , url2: %s\n", dfota1_url, dfota2_url); + + star_http_ota_updata(dfota1_url, dfota2_url, ver); + return ERRCODE_SUCC; +} + /* * 职责单一:仅触发"根据最近一次getTask结果下载并校验MD5"的动作 @@ -2088,6 +2151,8 @@ static const at_cmd_table_t g_ln_api_cmd[] = { //心跳间隔设置 {(char *)"AT^LN_WS_HEARTBEAT_INTERVAL", ln_ws_get_heartbeat_interval_sec_at, (char *)"获取心跳间隔: AT^LN_WS_HEARTBEAT_INTERVAL"}, {(char *)"AT^LN_WS_HEARTBEAT_INTERVAL_SET", ln_ws_set_heartbeat_interval_sec_at, (char *)"设置心跳间隔: AT^LN_WS_HEARTBEAT_INTERVAL_SET=60"}, + {(char *)"AT^LN_START_OTA_CAT1", ln_otca_cat1_at, (char *)"开始CAT1 OTA升级: AT^LN_START_OTA_CAT1"}, + }; -- 2.17.1