#include "ota/include/OtaModel.h"
#include "wearable_log.h"
#include "ln_api.h"
+#include "ln_api_interface.h"
#include "custom_utils.h"
#include "kv_store.h"
#include "battery_hal.h"
uint8_t min = 0;
const bool still_1047 = (uapi_get_fw_version(&maj, &mid, &min) == ERRCODE_SUCC && maj == 1 && mid == 0 &&
min == 47);
- char kv_mark[8] = {0};
- (void)UtilsGetValue("cat1_py34_upgrade_done", kv_mark, sizeof(kv_mark));
- const bool py34_prereq = (uapi_get_py_ver() >= 34) &&
- ((strcmp(kv_mark, "1") == 0) || uapi_cat1_ota_is_py34_verified());
+ const bool py34_prereq = ln_cat1_py34_prereq_met();
if (still_1047 && !py34_prereq) {
+ char kv_mark[8] = {0};
+ (void)UtilsGetValue("cat1_py34_upgrade_done", kv_mark, sizeof(kv_mark));
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
"[ota]CheckOtaResult: Cat1 round done but py34 prereq not met, py=%u kv=%s verified=%d, stay updating",
(unsigned)uapi_get_py_ver(), kv_mark, uapi_cat1_ota_is_py34_verified());
/** 是否满足「1.0.47 开机可直进 Cat1」的软件条件(KV 已标记 py34 升级成功则视为 false) */
static bool IsSoftwareVersion_1_0_47(void)
{
+ if (ln_cat1_already_at_v34_source_profile()) {
+ return false;
+ }
char mark[8] = {0};
(void)UtilsGetValue(kKvCat1Py34UpgradeDone, mark, sizeof(mark));
if (strcmp(mark, "1") == 0) {
return 0;
}
+/* 与 getTask 的 sourceVersion(如 47EG8AK0409V34_1/_2)一致:手表 1.0.47 + 模组 EG8AK0409 + py>=34 */
+int ln_cat1_already_at_v34_source_profile(void)
+{
+#ifdef SUPPORT_CAT1_SERVICE
+ uint8_t major = 0;
+ uint8_t mid = 0;
+ uint8_t minor = 0;
+
+ if (uapi_get_fw_version(&major, &mid, &minor) != ERRCODE_SUCC || major != 1 || mid != 0 || minor != 47) {
+ return 0;
+ }
+ if (uapi_get_py_ver() < 34) {
+ return 0;
+ }
+ char *modem_raw = cat1_api_runtime_get_cat1_modemver();
+ if (modem_raw == NULL || modem_raw[0] == '\0') {
+ return 0;
+ }
+ char modem_short[16] = {0};
+ if (get_modem_fw_version_c(modem_raw, modem_short) != 0) {
+ return 0;
+ }
+ if (strcmp(modem_short, "EG8AK0409") != 0) {
+ return 0;
+ }
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
+ "[OTA] already at 47EG8AK0409V34 profile (py=%u modem=%s), skip KV/verified",
+ (unsigned)uapi_get_py_ver(), modem_short);
+ return 1;
+#else
+ return 0;
+#endif
+}
+
/* 检查是否需要CAT1 OTA升级(在后台线程执行,避免阻塞UI线程) */
void ln_is_cat1_ota_upgrade_check(void)
{
if (py < LN_CAT1_PY34_MIN_VER && py != 32) {
return 0;
}
- /* 检查kv存储中是否已经升级完成 */
- /* 检查cat1模组中是否已经升级完成 */
+ if (ln_cat1_already_at_v34_source_profile()) {
+ return 1;
+ }
return ln_kv_cat1_py34_upgrade_done() || uapi_cat1_ota_is_py34_verified();
}
int ln_cat1_last_package_urls_target_py(void);
/** KV cat1_py34_upgrade_done 是否为 1 */
int ln_kv_cat1_py34_upgrade_done(void);
-/** Cat1 已真升到 Py34:KV 或本次 OTA verified */
+/** 本机已是 getTask 档位 47+EG8AK0409+V34(与 _1/_2 查询一致),无需 KV/verified */
+int ln_cat1_already_at_v34_source_profile(void);
+/** Cat1 已真升到 Py34:已是 V34 档位、KV 或本次 OTA verified */
int ln_cat1_py34_prereq_met(void);
#ifdef __cplusplus