From: 孙春阳 Date: Mon, 27 Apr 2026 14:02:17 +0000 (+0800) Subject: 1、添加AT^LN_START_OTA_CAT1 通过研发测试服下载cat1 ota X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3379%2Fhead;p=mirrors%2FFD230.git 1、添加AT^LN_START_OTA_CAT1 通过研发测试服下载cat1 ota 2、默认关闭uart flow ctl 3、release V1.0.47 版本 --- 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"}, + };