From: luozheng <1732036298@qq.com> Date: Fri, 3 Apr 2026 02:35:09 +0000 (+0800) Subject: pgnss指针置空,运动界面gps开始改成同步 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=d19834389324b5d5a464cbf03ab147e0c160a1f8;p=mirrors%2FFD230.git pgnss指针置空,运动界面gps开始改成同步 --- diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingModel.cpp index 60de425c3..4d49fb964 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingModel.cpp @@ -3269,11 +3269,13 @@ void TraingModel::SetGpsOpen(bool open) { TraingModel *model = TraingModel::GetInstance(); if (gps_timer_count == 5 && model != nullptr && !model->GetGpsOpen()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开启gps"); - GraphicService::GetInstance()->PostGraphicEvent([]() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "异步执行gnss_start()"); - gnss_start(); - }); - model->SetGpsOpen(true); + // GraphicService::GetInstance()->PostGraphicEvent([]() { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "异步执行gnss_start()"); + // gnss_start(); + // }); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "同步执行gnss_start()"); + gnss_start(); + model->SetGpsOpen(true); } gps_data_t send_gps_data = {0}; gps_data_t *gps_data = getPGPSGlobaldata(); diff --git a/code/sdk/zhihui/services/gnss/sample/pgnss_sample/pgnss_sample.c b/code/sdk/zhihui/services/gnss/sample/pgnss_sample/pgnss_sample.c index 4a5abf9b0..d8c583ca8 100644 --- a/code/sdk/zhihui/services/gnss/sample/pgnss_sample/pgnss_sample.c +++ b/code/sdk/zhihui/services/gnss/sample/pgnss_sample/pgnss_sample.c @@ -1013,8 +1013,16 @@ static int check_agnss_folder_expired(void) // 检查内存分配是否成功 if (candidate_folder_path == NULL || candidate_folder_name == NULL) { printf("ERROR: Failed to allocate memory for candidate folder variables\n"); - if (candidate_folder_path != NULL) free(candidate_folder_path); - if (candidate_folder_name != NULL) free(candidate_folder_name); + if (candidate_folder_path != NULL) + { + free(candidate_folder_path); + candidate_folder_path = NULL; + } + if (candidate_folder_name != NULL) + { + free(candidate_folder_name); + candidate_folder_name = NULL; + } closedir(dir); return 1; } @@ -1113,7 +1121,9 @@ static int check_agnss_folder_expired(void) // 如果找到了完整的有效文件夹,直接返回 if (found_valid_folder) { free(candidate_folder_path); + candidate_folder_path = NULL; free(candidate_folder_name); + candidate_folder_name = NULL; return 0; // 未过期 } @@ -1153,18 +1163,24 @@ static int check_agnss_folder_expired(void) free(g_current_agnss_folder); g_current_agnss_folder = NULL; free(candidate_folder_path); + candidate_folder_path = NULL; free(candidate_folder_name); + candidate_folder_name = NULL; return 1; // 失败 } } else { printf("ERROR: Failed to allocate memory for g_current_agnss_folder\n"); free(candidate_folder_path); + candidate_folder_path = NULL; free(candidate_folder_name); + candidate_folder_name = NULL; return 1; // 失败 } free(candidate_folder_path); + candidate_folder_path = NULL; free(candidate_folder_name); + candidate_folder_name = NULL; return 0; // 未过期,文件已完整 } @@ -1181,7 +1197,9 @@ static int check_agnss_folder_expired(void) printf("No valid AGNSS folder found within 24 hours with 26 files\n"); free(candidate_folder_path); + candidate_folder_path = NULL; free(candidate_folder_name); + candidate_folder_name = NULL; return 1; // 过期 }