From 97649ce0f99366b91a84891c81a2eae97d71f21c Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Fri, 21 Nov 2025 11:57:59 +0800 Subject: [PATCH] =?utf8?q?fd272=EF=BC=9A=E5=8E=8B=E5=8A=9B=E5=80=BC?= =?utf8?q?=E8=AE=A1=E7=AE=97=E6=9A=82=E6=97=B6=E7=94=A8=E5=B9=B3=E5=9D=87?= =?utf8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/stress/src/stressTestModel.cpp | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp index 8db5dc243..e3f56ee75 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp @@ -227,7 +227,7 @@ namespace OHOS } uint16_t average = sum / count; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "日期 %s 平均值: %u (共%d条记录)", dateStr, average, count); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "日期 %s 平均值: %u (共%d条记录)", dateStr, average, count); return average; } @@ -493,20 +493,27 @@ namespace OHOS if ((test_duration_sec_ >= STRESS_TEST_DURATION_SEC) && ringBufferIndex >= MAX_VALID_STRESS_COUNT) { + #if 1 // 计算最终结果,有效值的均值 - // uint16_t sum = 0; - // uint16_t count = (ringBufferIndex < 60) ? ringBufferIndex : 60; - // printf("测试结果:\n"); - // for (int i = 0; i < count; i++) - // { - // sum += ringBuffer[i]; - // printf("%d ", ringBuffer[i]); - // } - // printf("\n"); - // uint16_t finalMs = sum / count; - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "压力测试完成: 最终结果 %dms, 有效数据个数: %d", finalMs, count); - - + uint16_t sum = 0; + uint16_t count = (ringBufferIndex < 60) ? ringBufferIndex : 60; + printf("测试结果:\n"); + for (int i = 0; i < count; i++) + { + sum += ringBuffer[i]; + printf("%d ", ringBuffer[i]); + } + printf("\n"); + uint16_t finalMs = sum / count; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "压力测试完成: 最终结果 %dms, 有效数据个数: %d", finalMs, count); + StressTestModel::GetInstance().HandleResultValue(finalMs); // 分档上报 + // 切换到结果页面 + if (StressTestPresenter::GetInstance()) + { + StressTestPresenter::GetInstance()->ChangeViewOperation( + StressTestModel::GetInstance().GetCurrentView(), STRESSTESTRESULTVIEW); + } + #else uint16_t finalMs = CalculateReasonableStress(); if (finalMs == -1) { @@ -529,6 +536,7 @@ namespace OHOS StressTestModel::GetInstance().GetCurrentView(), STRESSTESTRESULTVIEW); } } + #endif // 停止压力测试 StressTest_StopTimer(); // 震动 -- 2.17.1