From 4d13f4f7534d23e0b8bebce1e7631f5fd8e58944 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Sat, 23 Nov 2024 18:32:25 +0800 Subject: [PATCH] =?utf8?q?=E8=BF=90=E5=8A=A8=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?utf8?q?=E8=BF=90=E5=8A=A8=E9=94=99=E8=AF=AF=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/traing/src/TraingModel.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp index 389d593cf..52851c7a9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -1709,7 +1709,6 @@ void LogError(const char *msg, osStatus_t ret) { /* 定时器回调函数 */ void TraingTimerCallback(void) { // 只在活动状态下进行更新 - if (!isPaused) { if (pauseStartTimestamp == 0) { //开始时将该值设置为运动开始值 @@ -1742,7 +1741,7 @@ void TraingTimerCallback(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "触发了振动。振动计数: %d", shock_count); } - } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TraingTimerCallback 被执行。"); } @@ -1788,12 +1787,11 @@ void StopAndResetTimer(void) { /* 暂停定时器 */ void PauseTimer(void) { - if (g_startCounting != NULL && !isPaused) { + if (g_startCounting != NULL) { osTimerStop(g_startCounting); totalPausedDuration = sportdata->duration; //记录暂停前的时间;后续加上 - isPaused = true; // 设置为暂停状态 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "定时器已暂停。暂停开始时间戳: %u", pauseStartTimestamp); } @@ -1801,7 +1799,7 @@ void PauseTimer(void) { /* 恢复定时器 */ void ResumeTimer(void) { - if (g_startCounting != NULL && isPaused) { + if (g_startCounting != NULL) { uint32_t currentTimestamp = OHOS::TraingModel::GetInstance()->get_current_time(); // 获取当前时间戳 @@ -1811,7 +1809,6 @@ void ResumeTimer(void) { if (osTimerStart(g_startCounting, tick) != osOK) { LogError("恢复定时器时启动失败", osError); } - isPaused = false; // 设置为活动状态 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "定时器已恢复。当前运动时间: %u %d", g_motionTimes, pauseStartTimestamp); -- 2.17.1