From 60a14ff907bde3ac1038cf830cefa1b3b7716e75 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Tue, 13 Jan 2026 11:48:31 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E5=BF=83=E7=8E=87=E8=AE=A1?= =?utf8?q?=E7=AE=97=EF=BC=8C=E6=B4=BB=E4=BD=93=E6=A3=80=E6=B5=8B=E4=BD=A9?= =?utf8?q?=E6=88=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c | 13 +++++++ code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c | 4 +- .../drivers/ppg/ppgBleService/ppgBleService.c | 37 +++++++------------ 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c b/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c index ef36bd7cc..7bc7cc44e 100644 --- a/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c +++ b/code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c @@ -1149,6 +1149,19 @@ void cywee_wearstatus_update(int wearstatus) cywee_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY_AND_NAP); } } + else if(uapi_dev_runtime_get_sleep_monitoring_status()) + { + if(uapi_dev_runtime_get_sleep_status()) + { + uapi_dev_runtime_set_absolute_static_status(1); + cywee_get_sleep_data(1); + } + else + { + cywee_inactivity_mode_change(INACTIVITY_MODE_NOTHING); + cywee_inactivity_mode_change(INACTIVITY_MODE_SLEEPING); + } + } wearstatus = 0; } diff --git a/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c b/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c index b9c439060..f9ecbbd32 100644 --- a/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c +++ b/code/sdk/zhihui/drivers/ppg/hx3695/hx3695.c @@ -376,7 +376,7 @@ uint16_t hx3695_read_fifo_data(ppg_sensor_data_t *ppg_sensor_dat) data_len_h = hx3695_read_reg(0x21); data_len_l = hx3695_read_reg(0x20); fifo_data_length = (((data_len_h&0x01)<<8)|data_len_l); - now_system_time = get_system_time(); + uapi_get_timestampe_ms(&now_system_time); exp_group = (now_system_time - last_system_time) / (1000 / ppg_sensor_dat->fs); for(uint8_t index = 0; index < 3; index++) @@ -1448,7 +1448,7 @@ void hx3695_alg_send_data(ppg_sensor_data_t *ppg_sensor_dat, WORK_MODE_T mode, u else if(hrs_result.living_status == MSG_LIVING_FAIL) { living_wear_cnt++; - if(living_wear_cnt >= 5) + if(living_wear_cnt >= 3) { avg_hrs = 0; living_status = 2; diff --git a/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c b/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c index 62ae4dec6..9c5c416f2 100644 --- a/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c +++ b/code/sdk/zhihui/drivers/ppg/ppgBleService/ppgBleService.c @@ -108,45 +108,36 @@ static void ble_ppgtest_add_character_and_information(uint8_t server_id, uint16_ ble_ppgtest_add_descriptor_report_reference(server_id,srvc_handle,false); } +// #define TY_DEMO + /* device向host发送数据:input report */ errcode_t ble_ppgtest_server_send_input_report(const uint8_t *data, uint8_t len) { // printf("ble_hid_server_send_input_report:%d %d %d",data[0],data[1],len); -#if 1 gatts_ntf_ind_t param = {0}; param.attr_handle = (uint16_t)g_ppgtest_notify_report_att_hdl; - param.value_len = len + 1; + param.value_len = len; + +#ifndef TY_DEMO + param.value_len = len + 1; +#endif + param.value = bt_os_new(param.value_len); - if (param.value == NULL) { - printf( "[ppgtest][ERROR]send input report new fail\r\n"); - return ERRCODE_BT_MALLOC_FAIL; - } - if (memcpy_s(param.value + 1, param.value_len, data, len) != EOK) - { - printf( "[ppgtest][ERROR]send input report memcpy fail\r\n"); - bt_os_free(param.value); - return ERRCODE_BT_FAIL; - } -#else - gatts_ntf_ind_t param = {0}; - param.attr_handle = (uint16_t)g_ppgtest_notify_report_att_hdl; - param.value_len = len; - param.value = bt_os_new(len); if (param.value == NULL) { printf( "[ppgtest][ERROR]send input report new fail\r\n"); return ERRCODE_BT_MALLOC_FAIL; } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) - { + +#ifndef TY_DEMO + param.value = param.value + 1; +#endif + + if (memcpy_s(param.value, param.value_len, data, len) != EOK) { printf( "[ppgtest][ERROR]send input report memcpy fail\r\n"); bt_os_free(param.value); return ERRCODE_BT_FAIL; } - - -#endif - errcode_t ret = 0; // if(g_ble_conn_id==0) -- 2.17.1