From: 袁清梦 <3449750381@qq.com> Date: Tue, 30 Apr 2024 06:35:54 +0000 (+0000) Subject: Merge #116 into xts_origin from refs/changes/116/head X-Git-Tag: release_V1.2.70_20241020_135402~1025^2~42^2^2~1 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=9594aee0d925f958b069869ea974c442327214fc;p=mirrors%2FFD230.git Merge #116 into xts_origin from refs/changes/116/head Code review from 袁清梦 * refs/changes/116/head: (3 commits squashed) - 修复时间显示 - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - 更新运动状态协议发送条件 Signed-off-by: Caisking <3449750381@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/116 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelTime.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelTime.cpp index d95831ea9..656f24eaf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelTime.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelTime.cpp @@ -70,18 +70,19 @@ static float ConvertHandSecondValueToAngle(int32_t handValue, uint16_t range) void DialModelTime::UpdateTime() { -#if 0 +#if 1 struct timeval tv; gettimeofday(&tv, NULL); tblock_ = localtime(&tv.tv_sec); int realMS = tblock_->tm_sec * S_MS_US_TRANS + tv.tv_usec / S_MS_US_TRANS; -#endif +#elif /*优化为更安全的localtime_r()*/ struct timeval tv; gettimeofday(&tv, NULL); struct tm tblock; localtime_r(&tv.tv_sec, &tblock); int realMS = tblock.tm_sec * S_MS_US_TRANS + tv.tv_usec / S_MS_US_TRANS; +#endif angleH_ = ConvertHandValueToAngle(tblock_->tm_hour, HALF_DAY_IN_HOUR, tblock_->tm_min, ONE_HOUR_IN_MINUTE); angleM_ = ConvertHandValueToAngle(tblock_->tm_min, ONE_HOUR_IN_MINUTE, tblock_->tm_sec, ONE_MINUTE_IN_SECOND); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h index 6a396a41b..2c20edd33 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h @@ -287,7 +287,7 @@ namespace OHOS bool Gettagstuats{false}; // 训练达标标志位 bool Startstate{false}; // 开始训练标志位 bool Endstate{false}; // 结束训练标志位 - bool Openingway{false}; // 运动开启方式 + bool Openingway{false}; // 运动开启方式 [0 手表 1 app] bool MomentumFlag{false}; // 训练量达标标志位 bool Openstate{false}; // 运动是否开始 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 f5fee7eb3..e47768f14 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -247,7 +247,8 @@ namespace OHOS /*设置运动状态*/ void TraingModel::SetSportState(ExerciseState state) { - if (state != ExerciseState::General) + /*运动开始并且是app发起的运动*/ + if (state != ExerciseState::General && Openingway == true) { sendtraningstatedata(static_cast(state), sportdata->duration); }