From: penglei <1624952103@qq.com> Date: Thu, 11 Jul 2024 10:36:25 +0000 (+0800) Subject: 优化运动数据协议传输,优化蓝牙产测获取PPGID,降低并且统一mag、ppg、cywee线程优先级以改善卡片播放音乐流畅度 X-Git-Tag: release_V1.2.70_20241020_135402~828^2~2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F505%2Fhead;p=mirrors%2FFD230.git 优化运动数据协议传输,优化蓝牙产测获取PPGID,降低并且统一mag、ppg、cywee线程优先级以改善卡片播放音乐流畅度 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp index 5e8bf305e..05fb0715f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp @@ -746,6 +746,7 @@ int AlarmClockModel::AlarmPlayerStat() return OHOS_FAILURE; } playerCtr->SetAudioSessionId(sessionId); + playerCtr->SetVolume(amIntance.GetMaxVolume(AUDIO_STREAM_ALARM_CLOCK),amIntance.GetMaxVolume(AUDIO_STREAM_ALARM_CLOCK)); // 播放 playerCtr->Play(); return OHOS_SUCCESS; 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 bf5c71671..d9c8030b6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -207,6 +207,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::~TraingModel()"); TraingUnsubscribeTopic(TOPIC_EVENT_ACTIVITY_UPDATE); // 取消订阅 TraingUnsubscribeTopic(TOPIC_EVENT_BLE_TRAINING); + TraingUnsubscribeTopic(TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE); } TraingModel *TraingModel::GetInstance(void) { @@ -218,6 +219,7 @@ namespace OHOS { TraingSubscribeTopic(TOPIC_EVENT_ACTIVITY_UPDATE); // 进行消息订阅 TraingSubscribeTopic(TOPIC_EVENT_BLE_TRAINING); + TraingSubscribeTopic(TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE); } /*设置运动类型*/ void TraingModel::SetSportType(Exercisetype type) @@ -373,7 +375,7 @@ namespace OHOS sportdata->pc = cyweeInfo->pace; sportdata->distance = cyweeInfo->distance; - if (sportdata->spc == 0 || sportdata->spc > sportdata->pc) + if (sportdata->spc < sportdata->pc) { sportdata->spc = sportdata->pc; } @@ -391,6 +393,7 @@ namespace OHOS custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒 TraingCardView::GetInstance()->SetPopupViewStatus(HeartPopup, true); } +#if 0 // sportdata->duration = cyweeInfo->duration; WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "normal sportdata->calories[%d],sportdata->heart[%d] \r\n", sportdata->calories, sportdata->heart); switch (type) @@ -406,6 +409,7 @@ namespace OHOS default: break; } +#endif /* -------------------------------------------------------------------------- */ // 首先需要判断有没有设置训练目标,并且保障弹窗只出现一次 if (sportdata->tag && (!Gettagstuats)) @@ -441,8 +445,8 @@ namespace OHOS sportdata->apc = cyweeInfo->avg_pace; sportdata->fpc = cyweeInfo->max_pace; } + /*打印函数*/ - void TraingModel::printf_data(SportData *data) { /*打印测试一下数据*/ diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 01520124a..0b32e8361 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -1029,6 +1029,7 @@ char * struct_to_json_buf_malloc_(uint8_t day) cJSON_AddNumberToObject(itemJSON,"ti",data->ti); cJSON_AddNumberToObject(itemJSON,"cir",data->cir); cJSON_AddNumberToObject(itemJSON,"alt",data->alt); + cJSON_AddNumberToObject(itemJSON,"apc",data->apc); cJSON_AddNumberToObject(itemJSON,"fpc",data->fpc); cJSON_AddNumberToObject(itemJSON,"spc",data->spc); cJSON_AddNumberToObject(itemJSON,"std",data->std); diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 46472a8ce..485b2d695 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -2110,6 +2110,10 @@ void GetAiResultCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,u sendBleData(sendBuf,19); } } +void GetGPSCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue) +{ + send_big_data(1,NULL,0,0,1,1,0x4f,2); +} void query_dial_installed(ble_read_data *buffer_handle,uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue)// { @@ -2385,6 +2389,10 @@ void type2AE4Data(ble_read_data *buffer_handle,uint8_t *buf_cmd,uint8_t *data,ui GetAiResultCmd(typeID,data,datalen,totalData,crcvalue); break; + case SYN_APP_GET_GPS_DATA_CMD://app获取GPS数据 + GetGPSCmd(typeID,data,datalen,totalData,crcvalue); + break; + default: break; } diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h index d1a79a943..38fa11453 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -616,6 +616,8 @@ TYPE:02 #define SYN_TODAY_BASIC_TRAIN_TXT_CMD 0x024D //同步当天任意时间之后的基础训练记录 +#define SYN_APP_GET_GPS_DATA_CMD 0x024F //同步gps信息 + #pragma pack(1) typedef struct { uint8_t drink_on;//提醒开关 0关闭 1开启 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 de96d0924..dd85af128 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-06-17 14:31:08 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-07-05 19:00:56 + * @LastEditTime: 2024-07-11 17:35:34 * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c * @Description: * @@ -36,6 +36,7 @@ #include "custom_runtime.h" #include "bletest.h" #include "battery_service.h" +#include "cywee_service.h" #pragma pack(1) typedef struct factorytest_cmd_header_t @@ -502,7 +503,24 @@ void factorytest_protocol_common_decode(uint8_t submode,uint8_t testitem,uint8_t 0x02, &send_data, 1); + } else if(testitem == 0x03) + { + uint8_t send_data = 0x00; + + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_STOP_ACC,NULL); + stop_custom_ble_service(); + LOS_Msleep(50); + uapi_set4GCapability(false); + LOS_Msleep(50); + mcu_pm_lcd_off(NULL,NULL) ; + mcu_pm_remove_vote(NULL,NULL); + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_COMMON, + BLE_TEST_CMD_COMMON_SUB_MODE_POWERCONSUMPTION, + 0x03, + &send_data, + 1); } + break; case BLE_TEST_CMD_COMMON_SUB_MODE_OTA: @@ -1139,8 +1157,7 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint { //获取 ppg_id uint8_t ppg_id; - hx3695_get_id(&ppg_id); - + uapi_ppg_get_id(&ppg_id); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_HRS, 0x01, diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index efe40b3be..b68bddc20 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -439,7 +439,7 @@ errcode_t uapi_cywee_service_init(void) app_task_definition_t taskcfg = {0}; taskcfg.create_queue_handle = create_cywee_queue; taskcfg.attr.name = "cywee_service"; - taskcfg.attr.priority = osPriorityNormal1; + taskcfg.attr.priority = osPriorityBelowNormal1; taskcfg.attr.stack_size = CYWEE_APP_BOARD_TASK_SIZE; taskcfg.func = cywee_service_check_task; taskcfg.use_mem = USE_EXTEND_MEM; diff --git a/code/sdk/drivers/peripheral/mag/service/mag_service.c b/code/sdk/drivers/peripheral/mag/service/mag_service.c index 249292334..c45867dcc 100644 --- a/code/sdk/drivers/peripheral/mag/service/mag_service.c +++ b/code/sdk/drivers/peripheral/mag/service/mag_service.c @@ -81,7 +81,7 @@ osTimerId_t g_mag_service_timer = NULL; static bool g_mag_sensor_exist = false; static bool g_bat_timer_is_running = false; -#define MAG_CHECK_MS 20 +#define MAG_CHECK_MS 40 static unsigned long g_app_queue; static bool mag_service_running_stat = false; diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 2a23769ce..362bff869 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -127,6 +127,8 @@ int cywee_data[2] = {0}; int wear_mode_status = -1; +static uint8_t hx3695_chip_id = 0; + //////// spo2 para and switches const uint8_t COUNT_BLOCK_NUM = 25; //delay the block of some single good signal after a series of bad signal const uint8_t SPO2_LOW_XCORR_THRE = 30; //(64*xcorr)'s square below this threshold, means error signal @@ -362,6 +364,7 @@ bool hx3695_chip_check(void) { uint8_t i = 0; uint8_t chip_id = 0; + hx3695_chip_id = 0; for(i=0; i<5; i++) { hx3695_ppg_on(); @@ -372,6 +375,7 @@ bool hx3695_chip_check(void) { //printf("hx3695_chip_check ok chip_id: 0x%x \r\n",chip_id); //Efuse_Mode_Check(); + hx3695_chip_id = chip_id; return true; } } @@ -383,21 +387,7 @@ bool hx3695_chip_check(void) void hx3695_get_id(uint8_t *ppg_id) { - uint8_t i = 0; - uint8_t chip_id = 0; - for(i=0; i<5; i++) - { - hx3695_ppg_on(); - hx3695_delay_ms(5); - chip_id = hx3695_read_reg(0x00); - - if (chip_id == 0x65) - { - *ppg_id = chip_id; - break; - } - } - hx3695_ppg_off(); + *ppg_id = hx3695_chip_id; } uint8_t hx3695_read_fifo_size(void) diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index c198c3bd8..9f7b9e3a7 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -369,7 +369,7 @@ errcode_t uapi_ppg_service_init(void) app_task_definition_t taskcfg={0}; taskcfg.create_queue_handle = create_ppg_queue; taskcfg.attr.name="ppg_service"; - taskcfg.attr.priority = osPriorityNormal1; + taskcfg.attr.priority = osPriorityBelowNormal1; taskcfg.attr.stack_size = PPG_SERVICE_TASK_SIZE; taskcfg.func = ppg_service_check_task; taskcfg.use_mem = USE_EXTEND_MEM;