From: SnickerSun Date: Tue, 26 Mar 2024 14:47:21 +0000 (+0800) Subject: 解决 ppg timer和 cywee timer 冲突造成 ppg总是失灵问题。 X-Git-Tag: release_V1.2.70_20241020_135402~1257^2~2 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=3ea3890ba12e274ed28afeae1bc63e775c6443b3;p=mirrors%2FFD230.git 解决 ppg timer和 cywee timer 冲突造成 ppg总是失灵问题。 --- diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index 1f61faeb6..724308e58 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -39,7 +39,7 @@ typedef struct * 其他cmd在Header里定义,对外开放 */ -#define CYWEE_CHECK_MS 40 +#define CYWEE_CHECK_MS 20 osTimerId_t g_cywee_service_timer = NULL; static bool g_batter_service_initialled = false; diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 5922f390c..16f1b3686 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -281,7 +281,7 @@ int cywee_main_dml(void) { memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; scl.iData[3] = 2; - scl.iData[4] = 1; //anytime + scl.iData[4] = 2; //1 anytime 2 fifo scl.iData[6] = 5; //先設定5 scl.iData[7] = 5; scl.iData[8] = 25; // for st sensor(52Hz) diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hrs_custom.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hrs_custom.c index bdb035e0a..5e1d00501 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hrs_custom.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hrs_custom.c @@ -138,7 +138,7 @@ void tyhx_delay_ms(uint32_t ms) - +#include "ppg_service.h" #include "cmsis_os2.h" #define BUTTON_APP_TIMER_INTERVAL 20 osTimerId_t g_timer40_timer = NULL; @@ -147,12 +147,14 @@ static uint8_t g_hx3695_timer_installed = 0; static void timer40_func(void) { - agc_timeout_handler(NULL); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_40TIMER_CALLBACK); + // agc_timeout_handler(NULL); } static void timer320_func(void) { - heart_rate_meas_timeout_handler(NULL); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_320TIMER_CALLBACK); + // heart_rate_meas_timeout_handler(NULL); } bool tyhx_timer_init(void) { diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index 3ed64b31f..3a388bdf9 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -179,7 +179,7 @@ errcode_t update_wearstatus_event_sendmsg_toUI(int32_t wearstatus) } #include "hx3695_hal.h" - +#include "hx3695.h" void hx3695_msg_callback(uint8_t msg_type, uint8_t *msg_data, int32_t msg_datalen) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hx3695_msg_callback"); @@ -279,10 +279,16 @@ static void ppg_service_check_task(void *arg) if (ret != OSAL_SUCCESS) { continue; } - + char* cmd = "hrs"; int enable = 1; - if (mail == PPG_SERVICE_CMD_TYPE_DO_PPG_TEST){ + if (mail == PPG_SERVICE_CMD_TYPE_DO_PPG_320TIMER_CALLBACK){ + heart_rate_meas_timeout_handler(NULL); + continue; + }else if (mail == PPG_SERVICE_CMD_TYPE_DO_PPG_40TIMER_CALLBACK){ + agc_timeout_handler(NULL); + continue; + }else if (mail == PPG_SERVICE_CMD_TYPE_DO_PPG_TEST){ cmd = "hrs"; enable = 1; }else if (mail == PPG_SERVICE_CMD_TYPE_DO_HRV_TEST){ diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h index 786965566..983767020 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h @@ -19,7 +19,8 @@ extern "C" { #include "stdint.h" #include "errcode.h" - +#define PPG_SERVICE_CMD_TYPE_DO_PPG_40TIMER_CALLBACK 0x0A +#define PPG_SERVICE_CMD_TYPE_DO_PPG_320TIMER_CALLBACK 0x10 #define PPG_SERVICE_CMD_TYPE_DO_PPG_TEST 0x11 #define PPG_SERVICE_CMD_TYPE_DO_HRV_TEST 0x12 #define PPG_SERVICE_CMD_TYPE_DO_SPO2_TEST 0x13