From: 袁清梦 <3449750381@qq.com> Date: Tue, 19 Nov 2024 14:54:11 +0000 (+0000) Subject: Merge #1428 into sdk602patch0911 from refs/changes/1428/head X-Git-Tag: fd230_release_V1.3.102~56^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=d8f9f3def29aae268f8bd2ab5291af7d4c4f0866;p=mirrors%2FFD230.git Merge #1428 into sdk602patch0911 from refs/changes/1428/head Code review from 袁清梦 * refs/changes/1428/head: (7 commits squashed) - 省电模式:优化提醒界面 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 系统:增加恢复出厂删除离线日志 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 训练:优化训练配速表心率表数据存储 - 心率:修复心率控制的错误修改 Signed-off-by: Caisking <3449750381@qq.com> Reviewed-by: Caisking <3449750381@qq.com> Reviewed-by: 罗正 <1732036298@qq.com> Reviewed-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Reviewed-by: aliyun6865282430 <1624952103@qq.com> Merged-by: Caisking <3449750381@qq.com> CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1428 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp index 2866700c3..d0db63df4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp @@ -391,9 +391,8 @@ void HeartModel::Heart_Control(HeartState state, HeartCheck check) { return; } - checkstate = check; //被动 - if (checkstate == HeartCheck::PASSIVITY) { + if (check == HeartCheck::PASSIVITY) { uapi_dev_runtime_set_hrs_passivity(1); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "uapi_dev_runtime_set_hrs_passivity(1)"); @@ -405,7 +404,6 @@ void HeartModel::Heart_Control(HeartState state, HeartCheck check) { "uapi_dev_runtime_set_hrs_passivity(0)"); } - if (state == HeartState::End && heartstate == true) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartState End"); //状态数全部清空 @@ -434,6 +432,7 @@ void HeartModel::Heart_Control(HeartState state, HeartCheck check) { uint8_t md = PPG_SERVICE_CMD_TYPE_DO_PPG_TEST; send_ppg_cmd_msg(md); heartstate = true; + checkstate = check; } } // 开始检测 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 042ad84ca..9aba0afd4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -48,6 +48,8 @@ #include #include +#include "bleService.h" + extern "C" errcode_t uapi_get_timestampe_ms(uint32_t *tm); #ifdef __cplusplus @@ -591,6 +593,9 @@ void TraingModel::SetTimestamp() { if (currentState == ExerciseState::Start && !Startstate) { // 设置训练 runtime 为 1 训练中 uapi_dev_runtime_set_train_status(1); + if (Openingway) { + uapi_ble_connect_param_update(10); + } // 更新用户数据 SetUserSportdata(); @@ -630,6 +635,9 @@ void TraingModel::SetTimestamp() { } else if (currentState == ExerciseState::End && !Endstate) { // 设置训练 runtime 为 0 训练结束 uapi_dev_runtime_set_train_status(0); + if (Openingway) { + uapi_ble_connect_param_update(50); + } sportdata->endtime = time; @@ -640,7 +648,7 @@ void TraingModel::SetTimestamp() { // 记录运动数据 // RecordSportData(); - + //配置最后的训练强度(平均心率为标准) SetIntensity(sportdata->avgheart); @@ -1259,7 +1267,7 @@ bool TraingModel::SaveSportData() { // 保存心率表 if (!SaveHeartTable()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SaveHeartRateData is error!"); - // uapi_dev_runtime_set_train_storage_status(0); // 恢复状态 + // uapi_dev_runtime_set_train_storage_status(0); // 恢复状态 // return false; } // 保存速度表 @@ -1421,7 +1429,7 @@ void TraingModel::PrintPaceTable() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Pace Table:"); for (const auto &entry : paceTable) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "时间戳: %u, 配速: %.2f", + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "时间戳: %u, 配速: %d", entry.timestamp, entry.pace); } } @@ -1618,25 +1626,25 @@ std::string TraingModel::DisplayMotionDuration() { motionDuration = oss.str(); - // 获取当前时间(以微秒为单位) - uint32_t currentTime = static_cast( - std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count()); + // // 获取当前时间(以微秒为单位) + // uint32_t currentTime = static_cast( + // std::chrono::duration_cast( + // std::chrono::system_clock::now().time_since_epoch()) + // .count()); - // 记录和检查上一次调用的时间 - static uint32_t lastCallTime = 0; - if (currentTime - lastCallTime < 1000000) { // 小于1秒 - return motionDuration; - } - lastCallTime = currentTime; // 更新最后调用时间 + // // 记录和检查上一次调用的时间 + // static uint32_t lastCallTime = 0; + // if (currentTime - lastCallTime < 1000000) { // 小于1秒 + // return motionDuration; + // } + // lastCallTime = currentTime; // 更新最后调用时间 // 如果 g_motionTimes 不为零,进行计算和数据存储 if (g_motionTimes > 0) { sportdata->duration = g_motionTimes; // 设置训练时长 // 每分钟进行配速和心率数据存储 - StoreDataIfMinutePassed(); + // StoreDataIfMinutePassed(); } return motionDuration; // 返回格式化的运动时长 @@ -1656,7 +1664,7 @@ void TraingModel::SendLiveDataIfNecessary() { // 每10秒进行配速和心率数据存储 void TraingModel::StoreDataIfMinutePassed() { - if (sportdata->duration % 10 == 0) { + if (sportdata->duration % 5 == 0) { uint32_t timestamp; //进行数据的筛选 if (uapi_get_timestampe_ss(×tamp) == ERRCODE_SUCC) { @@ -1683,6 +1691,10 @@ void TraingTimerCallback() { OHOS::TraingModel::GetInstance()->SendLiveDataIfNecessary(); // 更新时间目标完成度 OHOS::TraingModel::GetInstance()->CheckTimeTag(); + // 特殊运动才存储心率配速表 + if (OHOS::TraingModel::GetInstance()->GetIsSpecial()) + OHOS::TraingModel::GetInstance() + ->StoreDataIfMinutePassed(); //存储心率配速表 if ((sportdata->goaldegree >= 100) && (shock_count < 4)) { shock_count++;