From 920b949b2b2740de55ee3bd040bb6e2172623231 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Sat, 5 Jul 2025 18:17:33 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E5=8E=9F=E5=83=8F=E5=BF=83?= =?utf8?q?=E7=8E=87=E4=BD=A9=E6=88=B4=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../ppg/pah8009/sensor/pah800x_main.c | 46 +++++++------------ .../peripheral/rotary_encoder/mixo/mixo_hal.c | 2 +- .../rotary_encoder/mixo/mixo_service.c | 4 +- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/code/sdk/drivers/peripheral/ppg/pah8009/sensor/pah800x_main.c b/code/sdk/drivers/peripheral/ppg/pah8009/sensor/pah800x_main.c index b1225c649..e5d067957 100644 --- a/code/sdk/drivers/peripheral/ppg/pah8009/sensor/pah800x_main.c +++ b/code/sdk/drivers/peripheral/ppg/pah8009/sensor/pah800x_main.c @@ -87,9 +87,7 @@ static osTimerId_t g_pah8009_timer = NULL; static uint8_t time_cnt = 0; -static uint8_t history_wear_status = 2; - -static uint8_t cywee_wear_status = 0; +static int history_wear_status = -1; //============================================================================ // Private function @@ -109,16 +107,6 @@ static void report_stress_data(const ppg_mems_data_t *ppg_mems_data_alg, uint8_t static void error_handle(void); -static void pah8009_wearstatus_update(void) -{ - if(history_wear_status != cywee_wear_status) - { - history_wear_status = cywee_wear_status; -#ifdef SUPPORT_CYWEE_SERVICE - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_wear_status); -#endif - } -} static void pah8009_unwearstatus_update(void) { @@ -133,17 +121,24 @@ static void pah8009_unwearstatus_update(void) func(PPG_MSG_TYPE_WEARSTAT_UPDATE,&data,1); func(PPG_MSG_TYPE_WEARSTAT_UPDATE,&data,1); } +#endif +} - if(uapi_dev_runtime_get_train_status()) +static void pah8009_wearstatus_update(int wear_status) +{ + if(history_wear_status != wear_status) { - cywee_wear_status = 0; - pah8009_wearstatus_update(); + history_wear_status = wear_status; #ifdef SUPPORT_CYWEE_SERVICE - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_HRS_CHANGE,&data); + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,(uint8_t *)&history_wear_status); #endif } -#endif -} + + if(wear_status != 1) + { + pah8009_unwearstatus_update(); + } +} static void bubblesort(float *input,int count) { @@ -1325,16 +1320,7 @@ static void process(uint64_t timestamp) // PRINT("touch_flag : %d\n",touch_flag); -#ifdef SUPPORT_PPG_SERVICE - // ppg_msg_callback_t func = ppg_get_send_msg_callback_func(); - - // if(func != NULL) - // { - // uint8_t data = (uint8_t)touch_flag; - // cywee_wear_status = data; - // func(PPG_MSG_TYPE_WEARSTAT_UPDATE, &data, 1); - // } -#endif + pah8009_wearstatus_update(touch_flag); if (_main.ppg_is_enabled) { @@ -1688,7 +1674,7 @@ void pah8009_control(char *mode,uint8_t enable) pah_sensor_stop(); if(uapi_dev_runtime_get_sleep_monitoring_status() && uapi_dev_runtime_get_hrs_passivity_flag()) { - pah8009_wearstatus_update(); + pah8009_wearstatus_update(history_wear_status); uapi_dev_runtime_set_hrs_passivity(0); } } diff --git a/code/sdk/drivers/peripheral/rotary_encoder/mixo/mixo_hal.c b/code/sdk/drivers/peripheral/rotary_encoder/mixo/mixo_hal.c index 551e98e85..e4d7dcebb 100644 --- a/code/sdk/drivers/peripheral/rotary_encoder/mixo/mixo_hal.c +++ b/code/sdk/drivers/peripheral/rotary_encoder/mixo/mixo_hal.c @@ -24,7 +24,7 @@ void mixo_int_callback(pin_t pin, uintptr_t param) void mixo_check(void) { - if(mixo_get_check_mode() == TIMER_MODE) + // if(mixo_get_check_mode() == TIMER_MODE) mixo_ots_timer_callback(); // else if(mixo_get_check_mode() == INT_MODE) // { diff --git a/code/sdk/drivers/peripheral/rotary_encoder/mixo/mixo_service.c b/code/sdk/drivers/peripheral/rotary_encoder/mixo/mixo_service.c index 7fa8cd746..ad62a5b46 100644 --- a/code/sdk/drivers/peripheral/rotary_encoder/mixo/mixo_service.c +++ b/code/sdk/drivers/peripheral/rotary_encoder/mixo/mixo_service.c @@ -53,7 +53,7 @@ void mixo_service_timer_stop(void) if(mixo_service_timer_running == true && g_mixo_service_timer) { mixo_suspend(); - mixo_clean_result(); + // mixo_clean_result(); osTimerStop(g_mixo_service_timer); mixo_service_timer_running = false; } @@ -146,7 +146,7 @@ errcode_t uapi_mixo_service_init(void) return ERRCODE_FAIL; } - mixo_init(); + // mixo_init(); g_mixo_service_timer = osTimerNew((osTimerFunc_t)mixo_service_timer_callback, osTimerPeriodic, NULL, NULL); -- 2.17.1