From f81a165cd918777534c7a922f36caea01a483933 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Thu, 7 Aug 2025 12:29:41 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E8=BF=90=E5=8A=A8=E6=95=B0?= =?utf8?q?=E6=8D=AE=E5=88=B7=E6=96=B0=EF=BC=8C=E4=BC=98=E5=8C=96cywee?= =?utf8?q?=E6=9C=8D=E5=8A=A1=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../brandy/brandy_standard/thread_pri_init.c | 9 +- .../nativeui/traing/src/TraingModel.cpp | 6 + .../include/TraingCardPresenter.h | 4 +- .../training_card/src/TraingCardPresenter.cpp | 298 ++++++++++++------ .../debug_output_notification.cpp | 1 + .../config/target_config/brandy/config.py | 14 +- .../chips/brandy/include/platform_core.h | 41 ++- .../sdk/zhihui/UI/producttest/src/testGPS.cpp | 7 +- code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c | 5 +- code/sdk/zhihui/drivers/ppg/hal/ppg_hal.c | 4 +- .../drivers/ppg/ppgBleService/ppgBleService.c | 5 +- .../zhihui/utils/custom_fileoperate_service.c | 8 +- code/sdk/zhihui/utils/custom_utils.c | 5 +- code/sdk/zhihui/utils/custom_utils_at_cmd.c | 12 +- 14 files changed, 281 insertions(+), 138 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c index 61505be7a..7e6b57ec4 100644 --- a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c @@ -526,6 +526,11 @@ static void thread_main(const void *unused) // custom_i2c_init(I2C_BUS_3); // custom_i2c_init(I2C_BUS_0); custom_i2c_init(I2C_BUS_2); + +#ifdef SUPPORT_CYWEE_SERVICE + uapi_cywee_service_init(); +#endif + #ifdef ROTARYENCODER_MIXO uapi_mixo_service_init(); #endif @@ -533,10 +538,6 @@ static void thread_main(const void *unused) uapi_mag_service_init(); #endif -#ifdef SUPPORT_CYWEE_SERVICE - uapi_cywee_service_init(); -#endif - #ifdef ENABLE_LQBP002TA uapi_lqbp_service_init(); #endif diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/src/TraingModel.cpp index f8eeea0af..9be6b23a4 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/src/TraingModel.cpp @@ -2399,6 +2399,12 @@ static void sport_data_callbackProc(int data) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"heart_data_callbackProc::hrs = %d\n", hrs); #endif TraingModel::GetInstance()->AnalysisHeartData(hrs); + + if(TraingCardPresenter::GetInstance()) + { + TraingCardPresenter::GetInstance()->updataview(); + } + } static void sport_data_timer_callback(int data) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/include/TraingCardPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/include/TraingCardPresenter.h index a5e178afb..4791bc3eb 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/include/TraingCardPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/include/TraingCardPresenter.h @@ -48,7 +48,7 @@ public: void OnPause() override; void OnResume() override; void OnStop() override; - void OnTickEvent() override; + void OnTickEvent() override{}; void Notify() override {} bool OpenSensor(ExerciseClass type); @@ -60,7 +60,7 @@ public: void UpdateTimeOfControl(); void UpdateTimeOfData(); void UpdateDataView(); - + void updataview(); /*蓝牙开启运动*/ #ifdef BLE_SERVER_ENABLE bool send_sport_cmd(training_ble *cmd); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp index dc1cb0d07..393c42a40 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -41,7 +41,8 @@ extern "C" void do_cywee_service_check_msg(int cmd, int data[]); #define DEFAULT_DASH "--" #define DATATEST 0 -extern "C" { +extern "C" +{ void StartTimer(); void StopAndResetTimer(); void PauseTimer(); @@ -52,7 +53,8 @@ void ResumeTimer(); #ifdef SUPPORT_CYWEE_SERVICE #include "cywee_service.h" #endif -namespace OHOS { +namespace OHOS +{ REGIST_SLICE(VIEW_TRAININGCRAD, TraingCardView, TraingCardPresenter); @@ -61,115 +63,139 @@ static TraingCardPresenter *g_pTraingCardPresenter = nullptr; TraingCardPresenter::TraingCardPresenter() { g_pTraingCardPresenter = this; } -TraingCardPresenter::~TraingCardPresenter() { +TraingCardPresenter::~TraingCardPresenter() +{ // tag_ = 0; g_pTraingCardPresenter = nullptr; } -TraingCardPresenter *TraingCardPresenter::GetInstance() { +TraingCardPresenter *TraingCardPresenter::GetInstance() +{ static TraingCardPresenter instance; return &instance; } -void TraingCardPresenter::OnStart() { +void TraingCardPresenter::OnStart() +{ Presenter::OnStart(); // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 长亮屏 } -void TraingCardPresenter::OnPause(void) { +void TraingCardPresenter::OnPause(void) +{ Presenter::OnPause(); } -void TraingCardPresenter::OnResume(void) { +void TraingCardPresenter::OnResume(void) +{ Presenter::OnResume(); } -void TraingCardPresenter::OnStop(void) { +void TraingCardPresenter::OnStop(void) +{ Presenter::OnStop(); // ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 长亮屏 } -bool TraingCardPresenter::OnDrag(UIView &view, const DragEvent &event) { +bool TraingCardPresenter::OnDrag(UIView &view, const DragEvent &event) +{ UNUSED(view); return true; } // 计时器更新timer -void TraingCardPresenter::ModifiesTime() { +void TraingCardPresenter::ModifiesTime() +{ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ModifiesTime begin"); std ::string TimeStr = TraingModel::GetInstance()->DisplayMotionDuration(); /*灭屏状态不刷新UI*/ - if (uapi_get_screen_state() == 1) { + if (uapi_get_screen_state() == 1) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_get_screen_state is off"); return; } - if (TimeStr.empty()) { + if (TimeStr.empty()) + { WEARABLE_LOGE( WEARABLE_LOG_MODULE_APP, "TraingModel::GetInstance()->DisplayMotionDuration() nullptr"); return; } if (TrainingControlView::GetInstance() != nullptr && - TrainingDataView::GetInstance() != nullptr) { - if (TrainingControlView::GetInstance()->GetTimeLabel() != nullptr) { + TrainingDataView::GetInstance() != nullptr) + { + if (TrainingControlView::GetInstance()->GetTimeLabel() != nullptr) + { TrainingControlView::GetInstance()->GetTimeLabel()->SetText( TimeStr.c_str()); } - if (TrainingDataView::GetInstance()->GetTimeLabel() != nullptr) { + if (TrainingDataView::GetInstance()->GetTimeLabel() != nullptr) + { TrainingDataView::GetInstance()->GetTimeLabel()->SetText(TimeStr.c_str()); } } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ModifiesTime end"); } -//计时器 -void TraingCardPresenter::UpdateTimeOfControl() { +// 计时器 +void TraingCardPresenter::UpdateTimeOfControl() +{ std ::string TimeStr = TraingModel::GetInstance()->DisplayMotionDuration(); - if (TimeStr.empty()) { + if (TimeStr.empty()) + { WEARABLE_LOGE( WEARABLE_LOG_MODULE_APP, "TraingModel::GetInstance()->DisplayMotionDuration() nullptr"); return; } - if (TrainingControlView::GetInstance() != nullptr) { - if (TrainingControlView::GetInstance()->GetTimeLabel() != nullptr) { + if (TrainingControlView::GetInstance() != nullptr) + { + if (TrainingControlView::GetInstance()->GetTimeLabel() != nullptr) + { TrainingControlView::GetInstance()->GetTimeLabel()->SetText( TimeStr.c_str()); } } } -void TraingCardPresenter::UpdateTimeOfData() { +void TraingCardPresenter::UpdateTimeOfData() +{ std ::string TimeStr = TraingModel::GetInstance()->DisplayMotionDuration(); - if (TimeStr.empty()) { + if (TimeStr.empty()) + { WEARABLE_LOGE( WEARABLE_LOG_MODULE_APP, "TraingModel::GetInstance()->DisplayMotionDuration() nullptr"); return; } - if (TrainingDataView::GetInstance() != nullptr) { - if (TrainingDataView::GetInstance()->GetTimeLabel() != nullptr) { + if (TrainingDataView::GetInstance() != nullptr) + { + if (TrainingDataView::GetInstance()->GetTimeLabel() != nullptr) + { TrainingDataView::GetInstance()->GetTimeLabel()->SetText(TimeStr.c_str()); } } } /* --------------------------------- cywee库操作 - * -------------------------------- */ + * -------------------------------- */ /*开启cywee*/ -bool TraingCardPresenter::OpenSensor(ExerciseClass type) { +bool TraingCardPresenter::OpenSensor(ExerciseClass type) +{ // 防止重复开启 - if (opensensorstuats) { + if (opensensorstuats) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OpenSensor is opening!!"); return false; } // 根据不同的运动项目进行不同的运动 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingCardPresenter::OpenSensor!!"); #ifdef SUPPORT_CYWEE_SERVICE - switch (type) { + switch (type) + { case ExerciseClass::NORMAL: cywee_sport_mode_change(CYWEE_SERVICE_CMD_NORMAL_MODE); break; @@ -198,9 +224,11 @@ bool TraingCardPresenter::OpenSensor(ExerciseClass type) { } /*控制cywee*/ -bool TraingCardPresenter::ControlSensor(ExerciseState state) { +bool TraingCardPresenter::ControlSensor(ExerciseState state) +{ #ifdef SUPPORT_PPG_SERVICE - switch (state) { + switch (state) + { case ExerciseState::End: // 退出进入普通模式 do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NORMAL_MODE, NULL); @@ -221,8 +249,10 @@ bool TraingCardPresenter::ControlSensor(ExerciseState state) { return true; } -void TraingCardPresenter::RefreshData(SportData *sportdata) { - if (sportdata == nullptr) { +void TraingCardPresenter::RefreshData(SportData *sportdata) +{ + if (sportdata == nullptr) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sportdata is null"); return; } @@ -232,13 +262,16 @@ void TraingCardPresenter::RefreshData(SportData *sportdata) { return; std::string distanceStr; - if (sportdata->distance != 0) { + if (sportdata->distance != 0) + { double distance_km = sportdata->distance / 1000.0; // 转换为公里并保留两位小数 std::stringstream ss; ss << std::fixed << std::setprecision(2) << distance_km; distanceStr = ss.str(); - } else { + } + else + { distanceStr = DEFAULT_DASH; } @@ -247,8 +280,8 @@ void TraingCardPresenter::RefreshData(SportData *sportdata) { std::string stepsStr = (sportdata->steps != 0) ? std::to_string(sportdata->steps) : DEFAULT_DASH; std::string calorieStr = (sportdata->calories != 0) - ? std::to_string(sportdata->calories) - : DEFAULT_DASH; + ? std::to_string(sportdata->calories) + : DEFAULT_DASH; // 训练强度刷新 UIResourceTextId intensityid = TraingModel::GetInstance()->GetIntensity(); // printf("intensityid %d \r\n", intensityid); @@ -274,21 +307,33 @@ void TraingCardPresenter::RefreshData(SportData *sportdata) { } #if 1 /*刷新 time 和 data */ -void TraingCardPresenter::OnTickEvent(void) { +void TraingCardPresenter::updataview(void) +{ // 如果未开启训练,直接退出 - if (TraingModel::GetInstance()->GetSportState() == ExerciseState::General || - view_ == nullptr) { + if (TraingModel::GetInstance()->GetSportState() == ExerciseState::General) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::GetInstance()->GetSportState() == ExerciseState::General "); return; } - Control_Card cardId = static_cast(view_->GetCurrentPage()); + if (TraingCardView::GetInstance() == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "view_ == nullptr"); + return; + } - switch (cardId) { - case Control_Card::CONTROL: { + Control_Card cardId = static_cast(TraingCardView::GetInstance()->GetCurrentPage()); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "cardId %d", (int)cardId); + + switch (cardId) + { + case Control_Card::CONTROL: + { UpdateTimeOfControl(); // 更新控制界面的时间 break; } - case Control_Card::DATA: { + case Control_Card::DATA: + { UpdateDataView(); // 更新训练数据视图 break; } @@ -297,21 +342,26 @@ void TraingCardPresenter::OnTickEvent(void) { } } #else -void TraingCardPresenter::Notify(void) { +void TraingCardPresenter::Notify(void) +{ // 如果未开启训练,直接退出 if (TraingModel::GetInstance()->GetSportState() == ExerciseState::General || - view_ == nullptr) { + view_ == nullptr) + { return; } Control_Card cardId = static_cast(view_->GetCurrentPage()); - switch (cardId) { - case Control_Card::CONTROL: { + switch (cardId) + { + case Control_Card::CONTROL: + { UpdateTimeOfControl(); // 更新控制界面的时间 break; } - case Control_Card::DATA: { + case Control_Card::DATA: + { UpdateDataView(); // 更新训练数据视图 break; } @@ -320,7 +370,8 @@ void TraingCardPresenter::Notify(void) { } } #endif -void TraingCardPresenter::UpdateDataView() { +void TraingCardPresenter::UpdateDataView() +{ // 刷新计时 UpdateTimeOfData(); @@ -335,8 +386,9 @@ void TraingCardPresenter::UpdateDataView() { RefreshData(sportdata); } /* --------------------------------- 点击事件处理 - * --------------------------------- */ -bool TraingCardPresenter::OnClick(UIView &view, const ClickEvent &event) { + * --------------------------------- */ +bool TraingCardPresenter::OnClick(UIView &view, const ClickEvent &event) +{ const std::string viewId = view.GetViewId(); // 定义点击事件映射 @@ -344,48 +396,58 @@ bool TraingCardPresenter::OnClick(UIView &view, const ClickEvent &event) { actionMap = { // 暂停按键 {BUTTONSTOP, - [&]() { - auto currentState = TraingModel::GetInstance()->GetSportState(); - if (currentState == ExerciseState::Continue || - currentState == ExerciseState::Start) { - handlePauseState(); - } else if (currentState == ExerciseState::Pause) { - handleContinueState(); - } - }}, + [&]() + { + auto currentState = TraingModel::GetInstance()->GetSportState(); + if (currentState == ExerciseState::Continue || + currentState == ExerciseState::Start) + { + handlePauseState(); + } + else if (currentState == ExerciseState::Pause) + { + handleContinueState(); + } + }}, // 结束按键 {BUTTONEND, - [&]() { - // ControlSensor(ExerciseState::Pause); - TraingCardView::GetInstance()->SetPopupViewStatus(EndPopup, true); - TraingCardView::GetInstance()->RefreshEndView(); - }}, + [&]() + { + // ControlSensor(ExerciseState::Pause); + TraingCardView::GetInstance()->SetPopupViewStatus(EndPopup, true); + TraingCardView::GetInstance()->RefreshEndView(); + }}, // 确定结束 - {BUTTONEXIT, [&]() { handleEndState(); }}, + {BUTTONEXIT, [&]() + { handleEndState(); }}, // 返回 {BUTTONBACK, - [&]() { - // ControlSensor(ExerciseState::Continue); - TraingCardView::GetInstance()->SetPopupViewStatus(EndPopup, false); - }}, + [&]() + { + // ControlSensor(ExerciseState::Continue); + TraingCardView::GetInstance()->SetPopupViewStatus(EndPopup, false); + }}, // 确定达到目标 {BUTTONWINOK, - [&]() { - TraingCardView::GetInstance()->GetAnimator()->Stop(); - TraingCardView::GetInstance()->SetPopupViewStatus(GetTagPopup, - false); - }}, + [&]() + { + TraingCardView::GetInstance()->GetAnimator()->Stop(); + TraingCardView::GetInstance()->SetPopupViewStatus(GetTagPopup, + false); + }}, // 确定心率提醒 {BUTTONNOTE, - [&]() { - TraingCardView::GetInstance()->SetPopupViewStatus(HeartPopup, - false); - }}, + [&]() + { + TraingCardView::GetInstance()->SetPopupViewStatus(HeartPopup, + false); + }}, }; // 查找并执行对应的操作 auto it = actionMap.find(viewId); - if (it != actionMap.end()) { + if (it != actionMap.end()) + { it->second(); // 执行操作 return true; } @@ -397,14 +459,17 @@ bool TraingCardPresenter::OnClick(UIView &view, const ClickEvent &event) { // UNUSED(view); // return; // } -bool TraingCardPresenter::OnKeyAct(UIView &view, const KeyEvent &event) { +bool TraingCardPresenter::OnKeyAct(UIView &view, const KeyEvent &event) +{ /*消耗按键事件*/ return true; } #ifdef BLE_SERVER_ENABLE -bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { - if (cmd == nullptr) { +bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) +{ + if (cmd == nullptr) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "无效的运动命令 cmd 为空!"); return false; } @@ -415,14 +480,19 @@ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cmdstate:%d currentState:%d", cmdstate, currentState); int m_sportTag = 0; - switch (cmd->controlmd) { + switch (cmd->controlmd) + { case SETGOAL: // 仅在一般状态下允许设置目标 - if (currentState == ExerciseState::General) { - if (cmd->sportTagType == 0) { - //训练目标->m 需要转换 km + if (currentState == ExerciseState::General) + { + if (cmd->sportTagType == 0) + { + // 训练目标->m 需要转换 km m_sportTag = cmd->sportTag / 1000; - } else { + } + else + { m_sportTag = cmd->sportTag; } TraingModel::GetInstance()->SetSportTag( @@ -443,14 +513,18 @@ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { } // 仅在一般状态下允许开始运动 - if (cmdstate == ExerciseState::Start) { - if ((currentState == ExerciseState::General)) { - if (TraingCardView::GetInstance() == nullptr) { + if (cmdstate == ExerciseState::Start) + { + if ((currentState == ExerciseState::General)) + { + if (TraingCardView::GetInstance() == nullptr) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ble 开启运动"); uapi_set_screen_on_api(); // 亮屏 NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCRAD); // 设置目标类型和项目有且只有一次 - switch (cmd->sportType) { + switch (cmd->sportType) + { case 0: TraingModel::GetInstance()->SetSportEvent( STR_EXERCISE_OUTDOORWALKING); @@ -472,16 +546,20 @@ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { reply_APP_OpenSportModeCmd(true); handleStartState(); return true; - } else { + } + else + { reply_APP_OpenSportModeCmd(false); // return false; } } // 仅在运动状态为开始或继续时允许暂停 - if (cmdstate == ExerciseState::Pause) { + if (cmdstate == ExerciseState::Pause) + { if (currentState == ExerciseState::Start || - currentState == ExerciseState::Continue) { + currentState == ExerciseState::Continue) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ble 暂停运动"); reply_APP_SportPasueResetCmd(TraingModel::GetInstance()->GetSportTime()); handlePauseState(); @@ -491,7 +569,8 @@ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { // 仅在暂停状态下允许恢复运动 if (cmdstate == ExerciseState::Continue && - currentState == ExerciseState::Pause) { + currentState == ExerciseState::Pause) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ble 恢复运动"); reply_APP_SportPasueResetCmd(TraingModel::GetInstance()->GetSportTime()); handleContinueState(); @@ -501,8 +580,9 @@ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { // 仅在运动状态为开始、继续或暂停时允许结束运动 if (cmdstate == ExerciseState::End && (currentState == ExerciseState::Start || - currentState == ExerciseState::Continue || - currentState == ExerciseState::Pause)) { + currentState == ExerciseState::Continue || + currentState == ExerciseState::Pause)) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ble 结束运动"); uint32_t sport_time = TraingModel::GetInstance()->GetSportTime(); reply_APP_SportStopModeCmd(sport_time); @@ -524,7 +604,8 @@ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { #endif /*训练结束*/ -void TraingCardPresenter::handleEndState() { +void TraingCardPresenter::handleEndState() +{ TraingModel::GetInstance()->SetSportState(ExerciseState::End); ControlSensor(ExerciseState::End); uapi_set_screen_on_api(); // 亮屏 @@ -535,17 +616,21 @@ void TraingCardPresenter::handleEndState() { return; #endif // 是否达到训练目标 - if (TraingModel::GetInstance()->GetMomentum()) { + if (TraingModel::GetInstance()->GetMomentum()) + { // 进入训练详情 NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDDATA); NativeAbility::GetInstance().ClearSliceIdStack(); // 清空所有SLiceId栈元素 - } else { + } + else + { // 进入训练记录 // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING_RECORD); if (TraingModel::GetInstance()->GetEntryType() == APPLIST_ENTER) NativeAbility::GetInstance().ChangeSlice( VIEW_TRAINING, TransitionType::TRANSITION_BACK_TO_HEXAGONS); - else { + else + { NativeAbility::GetInstance().ChangeSlice( VIEW_MAIN, TransitionType::TRANSITION_BACK_TO_HEXAGONS); NativeAbility::GetInstance().ClearSliceIdStack(); // 清空所有SLiceId栈元素 @@ -555,7 +640,8 @@ void TraingCardPresenter::handleEndState() { } /*训练暂停*/ -void TraingCardPresenter::handlePauseState() { +void TraingCardPresenter::handlePauseState() +{ uapi_set_screen_on_api(); // 亮屏 TrainingControlView::GetInstance()->GetLabel()->SetTextId(STR_RESUME); TrainingControlView::GetInstance()->GetButton()->SetImageSrc( @@ -566,7 +652,8 @@ void TraingCardPresenter::handlePauseState() { } /*训练继续*/ -void TraingCardPresenter::handleContinueState() { +void TraingCardPresenter::handleContinueState() +{ uapi_set_screen_on_api(); // 亮屏 TrainingControlView::GetInstance()->GetLabel()->SetTextId(STR_PAUSE); TrainingControlView::GetInstance()->GetButton()->SetImageSrc( @@ -577,7 +664,8 @@ void TraingCardPresenter::handleContinueState() { } /*训练开始*/ -void TraingCardPresenter::handleStartState() { +void TraingCardPresenter::handleStartState() +{ ControlSensor(ExerciseState::Start); TraingModel::GetInstance()->SetSportOpenWay(true); } diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp index e4037e725..83e3c240f 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp @@ -1154,6 +1154,7 @@ namespace OHOS { if (toggleButtonOffline->IsVisible() == false) { + toggleButtonOffline->SetState(uapi_dev_runtime_get_hrs_ble_status()); toggleButtonOffline->SetViewId("hrs_ble_switch"); toggleButtonOffline->SetVisible(true); } diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index d553a55c2..0e51687b1 100644 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -409,7 +409,7 @@ target = { 'NANDFLASH_DS35X', 'BLE_INSTRUCT', # 'AILPAY_SUPPORT', - # 'SUPPORT_FACT_SERVICE', + # 'SUPPORT_FACTORY_SERVICE', # 'MEMORY_CORRUPTION', ], @@ -527,7 +527,7 @@ target = { 'ROTARYENCODER_HX3507', 'NANDFLASH_DS35X', # 'BLE_INSTRUCT', - # 'SUPPORT_FACT_SERVICE', + # 'SUPPORT_FACTORY_SERVICE', ], #添加自定义应用 'ram_component': [ @@ -636,7 +636,7 @@ target = { 'ROTARYENCODER_U8', 'NANDFLASH_DS35X', 'BLE_INSTRUCT', - 'SUPPORT_FACT_SERVICE', + 'SUPPORT_FACTORY_SERVICE', ], 'ram_component': [ 'audio_at_service', @@ -746,7 +746,7 @@ target = { 'TEST_GPS_UI', 'NANDFLASH_F35UQA', #'BLE_INSTRUCT', - 'SUPPORT_FACT_SERVICE', + 'SUPPORT_FACTORY_SERVICE', 'PPG_GH3X2X', ], 'ram_component': [ @@ -860,7 +860,7 @@ target = { 'NANDFLASH_F35UQA', 'PPG_VC921X', 'ROTARYENCODER_HX3508', - 'SUPPORT_FACT_SERVICE', + 'SUPPORT_FACTORY_SERVICE', # 'BLE_INSTRUCT' ], @@ -980,7 +980,7 @@ target = { 'BLE_INSTRUCT', 'PPG_PAH8009', # 'AILPAY_SUPPORT', - 'SUPPORT_FACT_SERVICE', + 'SUPPORT_FACTORY_SERVICE', # 'MEMORY_CORRUPTION', # 'SUPPORT_GNSS', # 'DISABLE_UART_LOG', @@ -994,7 +994,7 @@ target = { 'media_at_service', 'bt_manager_at_service', "ppg_sensor_pah8009", - # "ppgBleService", + "ppgBleService", "mag_sensor_mmc5603", "vibrator", "vibrator_service", diff --git a/code/sdk/drivers/chips/brandy/include/platform_core.h b/code/sdk/drivers/chips/brandy/include/platform_core.h index 7479c7667..ca609c58d 100644 --- a/code/sdk/drivers/chips/brandy/include/platform_core.h +++ b/code/sdk/drivers/chips/brandy/include/platform_core.h @@ -165,8 +165,11 @@ * Maximum UART buses * Defined here rather than in the uart_bus_t enum, due to needing to use it for conditional compilation */ +#ifdef DISABLE_UART_LOG +#define UART_BUS_MAX_NUMBER 3 // !< Max number of UARTS available +#else #define UART_BUS_MAX_NUMBER 2 // !< Max number of UARTS available - +#endif #define I2C_BUS_MAX_NUMBER 4 // !< Max number of I2C available #define I2C_4_IRQn I2C_0_IRQN #define I2C_5_IRQn I2C_0_IRQN @@ -194,6 +197,7 @@ #define CODELOADER_UART_TX_PIN S_MGPIO33 #define CODELOADER_UART_RX_PIN S_MGPIO34 +#if 0 #define LOG_UART_BUS UART_BUS_1 #define LOG_UART_TX_PIN S_MGPIO33 #define LOG_UART_RX_PIN S_MGPIO34 @@ -213,6 +217,41 @@ #define CHIP_FIXED_RX_PIN S_MGPIO34 #endif #endif +#endif +#ifdef DISABLE_UART_LOG + +#define SW_DEBUG_UART_BUS UART_BUS_2 +#define CHIP_FIXED_TX_PIN PIN_NONE +#define CHIP_FIXED_RX_PIN PIN_NONE + +#define LOG_UART_BUS UART_BUS_2 +#define LOG_UART_TX_PIN PIN_NONE +#define LOG_UART_RX_PIN PIN_NONE +#else + +#ifndef FT_SINGLE_UART +#define SW_DEBUG_UART_BUS UART_BUS_0 +#define CHIP_FIXED_TX_PIN S_MGPIO19 +#define CHIP_FIXED_RX_PIN S_MGPIO20 + +#define LOG_UART_BUS UART_BUS_0 +#define LOG_UART_TX_PIN S_MGPIO19 +#define LOG_UART_RX_PIN S_MGPIO20 + +#else +#define SW_DEBUG_UART_BUS UART_BUS_1 +#define CHIP_FIXED_TX_PIN S_MGPIO33 +#define CHIP_FIXED_RX_PIN S_MGPIO34 + +#define LOG_UART_BUS UART_BUS_1 +#define LOG_UART_TX_PIN S_MGPIO33 +#define LOG_UART_RX_PIN S_MGPIO34 + +#endif + + +#endif + #define CHIP_FIXED_UART_BUS UART_BUS_0 #define QSPI_MAX_NUMBER 3 diff --git a/code/sdk/zhihui/UI/producttest/src/testGPS.cpp b/code/sdk/zhihui/UI/producttest/src/testGPS.cpp index 02cb844e5..c8e77cd3b 100644 --- a/code/sdk/zhihui/UI/producttest/src/testGPS.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testGPS.cpp @@ -8,11 +8,12 @@ #if defined(SUPPORT_GNSS) #include "NMEA0183.h" +#include "pgnss_sample.h" // code/sdk/zhihui/services/gnss/inc/.h #include "producttest/include/testView.h" #include "producttest/include/testGPS.h" -#include "gnss_sample.h" +// #include "gnss_sample.h" #include "graphic_service.h" namespace OHOS { @@ -142,7 +143,7 @@ namespace OHOS { if (label_1_GPS_MSG != nullptr) { - gps_data_t * gpsdata=getGPSGlobaldata(); + gps_data_t * gpsdata=getPGPSGlobaldata(); gps_data_t gpsd={0}; if (gpsdata->last_gps_time_ms>0) { @@ -152,7 +153,7 @@ namespace OHOS dump_location_data_to_buf(&gpsd,msgtmp,sizeof(msgtmp)); label_1_GPS_MSG->SetText(msgtmp); - if (getGnssServerStat()==1) + if (getPGnssServerStat()==1) { label_1_GPS_on_or_off->SetText("GPS开"); }else{ diff --git a/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c b/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c index cc1fdb5da..63733ce6d 100644 --- a/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c +++ b/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c @@ -155,7 +155,7 @@ uint8_t cywee_get_log_flag(void) static void cywee_gnss_update(void) { #ifdef SUPPORT_GNSS - gps_data_t *gps_data = getGPSGlobaldata(); + gps_data_t *gps_data = getPGPSGlobaldata(); if(gps_data == NULL) { PRINT("gps_data == NULL \n"); @@ -1849,7 +1849,8 @@ int cywee_start(void) scl.iData[0] = 1; scl.iData[1] = 31010100; #ifdef CYWEE_MAC_ACTIVE - scl.iData[5] = (int)SEC_FILE_ADDR; + if(SEC_FILE_ADDR != NULL) + scl.iData[5] = (int)SEC_FILE_ADDR; #endif CWM_SettingControl(SCL_CHIP_VENDOR_CONFIG, &scl); //1.Init data diff --git a/code/sdk/zhihui/drivers/ppg/hal/ppg_hal.c b/code/sdk/zhihui/drivers/ppg/hal/ppg_hal.c index ed35c71a2..5f8f48062 100644 --- a/code/sdk/zhihui/drivers/ppg/hal/ppg_hal.c +++ b/code/sdk/zhihui/drivers/ppg/hal/ppg_hal.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-13 15:08:38 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2025-07-28 17:37:22 + * @LastEditTime: 2025-08-07 12:01:02 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c * @Description: * @@ -85,7 +85,7 @@ uint8_t ppg_get_hrs(void) hrs = pah8009_get_hrs(); #endif - printf("ppg_get_hrs : %d\n",hrs); + // printf("ppg_get_hrs : %d\n",hrs); return hrs; } diff --git a/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c b/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c index 9d8bce28a..f6506c23b 100644 --- a/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c +++ b/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c @@ -11,6 +11,7 @@ extern "C" { #ifdef SUPPORT_BLE_SERVICE #include "bleService.h" +#endif #include "bts_gatt_stru.h" #include "bts_a2dp_source.h" #include "bts_gatt_server.h" @@ -62,7 +63,7 @@ static void ble_ppgtest_add_service(uint8_t server_id) bts_data_to_uuid_len2(BLE_UUID_PPG_BLE_SERVICE, &ppgtest_service_uuid); //只有一个服务,永远是1 errcode_t ret = 0; -#ifndef SUPPORT_OHOSFWK +#ifndef SUPPORT_AT_OHOSFWK ret = gatts_add_service(server_id, &ppgtest_service_uuid, true); // printf("ble_ppgtest_add_service wrapper_gatts_add_service ret: 0x%x server_id = 0x%x uuid.uuid_len:%d\n", ret, server_id,ppgtest_service_uuid.uuid_len); #else @@ -158,7 +159,7 @@ void ble_ppgtest_server_init(uint8_t server_id) { ble_ppgtest_add_service(server_id); } -#endif + #ifdef __cplusplus } diff --git a/code/sdk/zhihui/utils/custom_fileoperate_service.c b/code/sdk/zhihui/utils/custom_fileoperate_service.c index f0c8cb1cf..80e942f4f 100644 --- a/code/sdk/zhihui/utils/custom_fileoperate_service.c +++ b/code/sdk/zhihui/utils/custom_fileoperate_service.c @@ -52,7 +52,7 @@ extern "C" { #endif -#ifdef SUPPORT_FACT_SERVICE +#ifdef SUPPORT_FACTORY_SERVICE #include "factorytest_protocol.h" #endif #ifdef SUPPORT_CYWEE_SERVICE @@ -63,7 +63,7 @@ extern "C" #include "mag_hal.h" #endif -#ifdef SUPPORT_FACT_SERVICE +#ifdef SUPPORT_FACTORY_SERVICE #include "factorytest_protocol.h" #endif @@ -215,13 +215,13 @@ static void custom_fileoperate_service_check_task(void const *arg) break; case CUSTOM_FILEOPERATE_MSG_TYPE_AGING_DATA_READ: -#ifdef SUPPORT_FACT_SERVICE +#ifdef SUPPORT_FACTORY_SERVICE factorytest_read_aging_data(); #endif break; case CUSTOM_FILEOPERATE_MSG_TYPE_AGING_DATA_SAVE: -#ifdef SUPPORT_FACT_SERVICE +#ifdef SUPPORT_FACTORY_SERVICE factorytest_save_aging_data(); #endif break; diff --git a/code/sdk/zhihui/utils/custom_utils.c b/code/sdk/zhihui/utils/custom_utils.c index cadae82a4..043b12d7a 100644 --- a/code/sdk/zhihui/utils/custom_utils.c +++ b/code/sdk/zhihui/utils/custom_utils.c @@ -3282,6 +3282,7 @@ uint8_t DEFAULT_MAC_KEY[] = { #endif uint8_t* uapi_cywee_get_mac_key(void) { + uint8_t *data = NULL; #ifdef CYWEE_MAC_ACTIVE if(access(CYWEE_MAC_KEY_PATH, F_OK) == -1) { @@ -3290,7 +3291,6 @@ uint8_t* uapi_cywee_get_mac_key(void) // uapi_get_file_data(CYWEE_MAC_KEY_PATH,key_data,len); FILE *file; uint16_t fileSize; - uint8_t *data = NULL; file = fopen(CYWEE_MAC_KEY_PATH, "rb"); if (file == NULL) { @@ -3315,9 +3315,8 @@ uint8_t* uapi_cywee_get_mac_key(void) return NULL; } fclose(file); - return data; #endif - return NULL; + return data; } void uapi_get_a5133_rxdata(uint8_t *databuf,uint8_t len) diff --git a/code/sdk/zhihui/utils/custom_utils_at_cmd.c b/code/sdk/zhihui/utils/custom_utils_at_cmd.c index 16881da6e..a41573d3b 100644 --- a/code/sdk/zhihui/utils/custom_utils_at_cmd.c +++ b/code/sdk/zhihui/utils/custom_utils_at_cmd.c @@ -19,6 +19,7 @@ #ifdef SUPPORT_BATTERY_SERVICE #include "battery_hal.h" +#include "battery_service.h" #endif @@ -28,7 +29,7 @@ #include "Bluetooyhpabpserver.h" #include "dial_sos_c.h" -#include "battery_service.h" + #endif // #include "msg_center_customerC.h" #ifdef SUPPORT_A5133_SERVICE @@ -40,6 +41,10 @@ #include "cywee_service.h" #endif +#ifdef SUPPORT_PPG_SERVICE +#include "ppg_hal.h" +#endif + #define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0])) #define CUSTOM_UTILS_MAX_ARGC 8 #define CUSTOM_UTILS_MAX_ARGV_LEN 256 @@ -333,9 +338,10 @@ static uint32_t custom_get_ppg_id(uint8_t *para, uint32_t paraLen, char *strComm { UNUSED(strCommonCmd); - uint8_t chip_id = 0; - // uapi_ppg_get_id(&chip_id); +#ifdef SUPPORT_PPG_SERVICE + uint8_t chip_id = ppg_get_chip_id(); wstp_print("ppg_id[%x]\n",chip_id); +#endif return ERRCODE_SUCC; } -- 2.17.1