From: luozheng <1732036298@qq.com> Date: Thu, 13 Jun 2024 07:41:32 +0000 (+0800) Subject: 1.优化在使用ScreenAlwaysOnCtr函数设置是否屏幕常亮时, X-Git-Tag: release_V1.2.70_20241020_135402~1007 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=9341e4efc538a69de4ef294bef0ca565ba23a895;p=mirrors%2FFD230.git 1.优化在使用ScreenAlwaysOnCtr函数设置是否屏幕常亮时, (1)使用宏 OPEN_SCREEN_ALWAYS_ON 代替常量值 1 ,表示开启屏幕常亮功能。 (2)使用宏 CANCEL_SCREEN_ALWAYS_ON 代替常量值 0,表示取消屏幕常亮功能 2.优化呼吸训练:训练过程中开启心率检测,训练完成获取心率值展示在完成视图上。 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp index 516365c85..c4ecc3724 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-14 15:02:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-07 20:23:18 + * @LastEditTime: 2024-06-13 15:22:10 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -31,7 +31,7 @@ namespace OHOS void MainCompassPresenter::OnStart() { Presenter::OnStart(); - ScreenAlwaysOnCtr(1); + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } void MainCompassPresenter::OnPause(void) {} @@ -40,7 +40,7 @@ namespace OHOS void MainCompassPresenter::OnStop(void) { - ScreenAlwaysOnCtr(0); + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); } MainCompassPresenter *MainCompassPresenter::GetInstance() diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp index 40ea1b5b7..ba676b505 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp @@ -39,7 +39,7 @@ namespace OHOS void MainCountDownPresenter::OnStart() { Presenter::OnStart(); - ScreenAlwaysOnCtr(1); // 长亮屏 + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 长亮屏 } void MainCountDownPresenter::OnPause(void) @@ -57,7 +57,7 @@ namespace OHOS void MainCountDownPresenter::OnStop(void) { Presenter::OnStop(); - ScreenAlwaysOnCtr(0); // 取消长亮屏 + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 取消长亮屏 } bool MainCountDownPresenter::OnDrag(UIView &view, const DragEvent &event) diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp index dc6954c02..de4d495b6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-13 11:46:34 + * @LastEditTime: 2024-06-13 15:22:59 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp */ @@ -49,7 +49,7 @@ namespace OHOS p_RecordingModel->InitRecordingListItem(); p_RecordingModel->AudioInit(); Presenter::OnStart(); - //ScreenAlwaysOnCtr(1); + //ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } void RecordingPresenter::OnPause(void) @@ -67,7 +67,7 @@ namespace OHOS { Presenter::OnStop(); p_RecordingModel->ClearRecordingPlayer(); - //ScreenAlwaysOnCtr(0); + //ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); } bool RecordingPresenter::OnDrag(UIView &view, const DragEvent &event) diff --git a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp index 65e03b6ca..6d67e862c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-11 16:26:20 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-12 11:00:29 + * @LastEditTime: 2024-06-13 15:10:37 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp */ #include "respiratorytraining/include/RespiratoryTrainingModel.h" @@ -13,6 +13,7 @@ #include #include #include "respiratorytraining/include/RespiratoryTrainingView.h" +#include "heartrate/include/HeartModel.h" namespace OHOS { // 声明定时器变量 @@ -47,7 +48,8 @@ namespace OHOS // 获取心率值 std::string RespiratoryTrainingModel::GetHeartRateValue(void) { - HeartRateValue = "144"; + uint16_t value = HeartModel::GetInstance()->GetHeartdata(); + HeartRateValue = std::to_string(value); return HeartRateValue; } @@ -55,6 +57,7 @@ namespace OHOS { Time = 5; START_FLAG = false; + HeartModel::GetInstance()->Heart_Control(HeartState::End); // 关闭心率检测 } /* -------------------------------------------------------------------------- */ /*定时器到期时的处理*/ @@ -72,16 +75,18 @@ namespace OHOS { if (START_FLAG == true) { - RespiratoryTrainingModel::GetInstance().RT_StopTimer(); // 停止定时器 - RespiratoryTrainingModel::GetInstance().AddRespiratoryTrainingTimes(); - p_RespiratoryTrainingView->GetRespiratoryTrainingAnimator_()->Stop(); + RespiratoryTrainingModel::GetInstance().RT_StopTimer(); // 停止定时器 + RespiratoryTrainingModel::GetInstance().AddRespiratoryTrainingTimes(); // 呼吸训练次数加1 + p_RespiratoryTrainingView->GetRespiratoryTrainingAnimator_()->Stop(); // 关闭呼吸动画 + HeartModel::GetInstance()->Heart_Control(HeartState::End); // 关闭心率检测 p_RespiratoryTrainingView->ChangeView(RESPIRATORYTRAINING, RESPIRATORYTRAININGCOMPLETED); } else { Time = ONE_MINUTE; - p_RespiratoryTrainingView->StartRespiratoryTraining(); + p_RespiratoryTrainingView->StartRespiratoryTraining(); // 开始呼吸训练 START_FLAG = true; + HeartModel::GetInstance()->Heart_Control(HeartState::Start); // 开启心率检测 } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp index 68bc55d64..0a3412b80 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:26:06 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-12 11:13:13 + * @LastEditTime: 2024-06-13 15:17:08 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/RespiratoryTraining/src/RespiratoryTrainingPresenter.cpp */ @@ -40,7 +40,7 @@ namespace OHOS void RespiratoryTrainingPresenter::OnStart() { Presenter::OnStart(); - ScreenAlwaysOnCtr(1); + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } void RespiratoryTrainingPresenter::OnPause(void) @@ -56,7 +56,7 @@ namespace OHOS void RespiratoryTrainingPresenter::OnStop(void) { Presenter::OnStop(); - ScreenAlwaysOnCtr(0); + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); RespiratoryTrainingModel::GetInstance().RT_StopTimer(); RespiratoryTrainingModel::GetInstance().ResumeStatus(); } @@ -65,7 +65,7 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RespiratoryTrainingPresenter::OnClick"); std::string viewId = view.GetViewId(); - if(viewId == RTCLABELBUTTON) + if (viewId == RTCLABELBUTTON) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp index 1c58e32b9..db22636f4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp @@ -33,7 +33,7 @@ namespace OHOS void MainStopWatchPresenter::OnStart() { Presenter::OnStart(); - ScreenAlwaysOnCtr(1); // 长亮屏 + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 长亮屏 } void MainStopWatchPresenter::OnPause(void) @@ -51,7 +51,7 @@ namespace OHOS void MainStopWatchPresenter::OnStop(void) { Presenter::OnStop(); - ScreenAlwaysOnCtr(0); // 取消长亮屏 + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 取消长亮屏 } /// @brief 设置复选框和按钮 diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp index d14517dd8..373e3e682 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -62,7 +62,7 @@ namespace OHOS void TraingCardPresenter::OnStart() { Presenter::OnStart(); - // ScreenAlwaysOnCtr(1); // 长亮屏 + // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 长亮屏 } void TraingCardPresenter::OnPause(void) @@ -81,7 +81,7 @@ namespace OHOS { Presenter::OnStop(); - ScreenAlwaysOnCtr(0); // 长亮屏 + //ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 长亮屏 } bool TraingCardPresenter::OnDrag(UIView &view, const DragEvent &event) diff --git a/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp index 851f5aa05..1bf455ac1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp @@ -32,7 +32,7 @@ namespace OHOS void WatchQRCodePresenter::OnStart() { Presenter::OnStart(); - ScreenAlwaysOnCtr(1); + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } void WatchQRCodePresenter::OnResume(void) @@ -43,7 +43,7 @@ namespace OHOS void WatchQRCodePresenter::OnStop(void) { Presenter::OnStop(); - ScreenAlwaysOnCtr(0); + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); return; } diff --git a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c index de9e3e390..0a1cb4e73 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -1014,7 +1014,7 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint //LCD显示颜色 uint8_t send_data = 0x00; char *color_buf[5] ={"0Xffff0000","0xff00ff00","0xff0000ff","0xffffffff","0xff000000"}; - ScreenAlwaysOnCtr(1); + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); switch (*data) { case 1: diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index 1b654cba9..80537d642 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -27,6 +27,9 @@ extern "C" { #define TASK_PRIORITY_DFX_MSG (osPriority_t)(18) #define TASK_PRIORITY_TRANSMIT (osPriority_t)(20) +#define OPEN_SCREEN_ALWAYS_ON 1 //屏幕常亮 +#define CANCEL_SCREEN_ALWAYS_ON 0 //取消屏幕常亮 + uint32_t zh_get_sn(uint8_t *buf_sn, uint32_t *len_sn); uint32_t zh_set_sn(uint8_t *buf_sn, uint32_t len_sn);