From 5daae43b4b0bc37ed6e01533c2efb7b26426d184 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Mon, 17 Jun 2024 18:45:44 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E8=93=9D=E7=89=99=E4=BA=A7?= =?utf8?q?=E6=B5=8B=E4=B8=8E=E5=BC=80=E6=9C=BA=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../factorytest_protocol.c | 129 +++++++----------- .../drivers/peripheral/cywee/Inc/cywee_hal.h | 3 +- .../peripheral/cywee/service/cywee_service.c | 6 +- .../drivers/peripheral/cywee/src/main_dml.c | 10 +- .../peripheral/mag/mmc5603/mmc5603_main.c | 3 + .../drivers/peripheral/ppg/hx3695/hx3695.c | 2 +- .../peripheral/ppg/hx3695/hx3695_hal.c | 6 +- .../peripheral/ppg/service/ppg_service.cpp | 3 + .../peripheral/ppg/service/ppg_service.h | 3 +- .../service/src/graphic_service_wrapper.cpp | 14 +- 10 files changed, 73 insertions(+), 106 deletions(-) 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 2d42caf8e..64073c01f 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -1,3 +1,13 @@ +/* + * @Author: penglei 1624952103@qq.com + * @Date: 2024-06-17 14:31:08 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-06-17 17:51:27 + * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c + * @Description: + * + * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. + */ /* * Copyright (c) @CompanyNameMagicTag 2022. All rights reserved. * Description: BT HID Service Server Module. @@ -69,9 +79,6 @@ static osTimerId_t g_ble_vibrator_timer = NULL; static osTimerId_t g_ble_acc_timer = NULL; -static osTimerId_t g_ble_hrs_timer = NULL; -static osTimerId_t g_ble_spo2_timer = NULL; - static osTimerId_t g_ble_microhone_timer = NULL; static osTimerId_t g_ble_spk_timer = NULL; @@ -171,77 +178,6 @@ void ble_acc_check_timer_callback(void) 6); } -void ble_hrs_check_timer_callback(void) -{ - uint8_t databuf[4] = {0}; - int32_t ppg_buf; - uint8_t i; - if(ble_hrs_flag != 1) - return; - else - { - osTimerStop(g_ble_hrs_timer); - osTimerDelete(g_ble_hrs_timer); - ble_hrs_flag = 0; - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); - - if(ble_hrs_data > 10000) - { - ppg_buf = ble_hrs_data; - - databuf[0] = (uint8_t)((ppg_buf & 0xFF000000) >> 24); - databuf[1] = (uint8_t)((ppg_buf & 0x00FF0000) >> 16); - databuf[2] = (uint8_t)((ppg_buf & 0x0000FF00) >> 8); - databuf[3] = (uint8_t)((ppg_buf & 0x000000FF) >> 0); - - PRINT("%2X %2X %2X %2X \r\n",databuf[0],databuf[1],databuf[2],databuf[3]); - - factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, - BLE_TEST_CMD_SOFT_TEST_SUB_MODE_HRS, - 0x07, - databuf, - 4); - } - } - -} - -void ble_spo2_check_timer_callback(void) -{ - uint8_t databuf[4] = {0}; - int32_t red_buf; - - if(ble_spo2_flag != 1) - return; - else - { - osTimerStop(g_ble_spo2_timer); - osTimerDelete(g_ble_spo2_timer); - ble_spo2_flag = 0; - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_SPO2_TEST); - - if(ble_spo2_data > 10000) - { - red_buf = ble_spo2_data; - - databuf[0] = (uint8_t)((red_buf & 0xFF000000) >> 24); - databuf[1] = (uint8_t)((red_buf & 0x00FF0000) >> 16); - databuf[2] = (uint8_t)((red_buf & 0x0000FF00) >> 8); - databuf[3] = (uint8_t)((red_buf & 0x000000FF) >> 0); - - PRINT("%2X %2X %2X %2X \r\n",databuf[0],databuf[1],databuf[2],databuf[3]); - - factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, - BLE_TEST_CMD_SOFT_TEST_SUB_MODE_HRS, - 0x08, - databuf, - 4); - } - } - - -} - void ble_microhone_check_timer_callback(void) { PRINT("ble_microhone_check_timer_callback \r\n"); @@ -261,7 +197,6 @@ void ble_microhone_check_timer_callback(void) void ble_spk_check_timer_callback(void) { - PRINT("ble_spk_check_timer_callback \r\n"); uint8_t send_data= 0; uapi_check_spk(0); @@ -1230,19 +1165,47 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint 0x02, &send_data, 1); - } else if(testitem == 0x07) + } else if(testitem == 0x03) { //打开心率检测 - g_ble_hrs_timer = osTimerNew((osTimerFunc_t)ble_hrs_check_timer_callback, osTimerPeriodic, NULL, NULL); - osTimerStart(g_ble_hrs_timer,400); - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_TEST); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_SINGLE_CHECK_MODE_TEST); + FT_RESULTS_t ft_result = hx3695_factroy_test(SINGLE_CHECK_TEST); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); + uint8_t databuf[4] = {0}; - } else if(testitem == 0x08) + databuf[0] = (uint8_t)((ft_result.gr_data_final & 0xFF000000) >> 24); + databuf[1] = (uint8_t)((ft_result.gr_data_final & 0x00FF0000) >> 16); + databuf[2] = (uint8_t)((ft_result.gr_data_final & 0x0000FF00) >> 8); + databuf[3] = (uint8_t)((ft_result.gr_data_final & 0x000000FF) >> 0); + + PRINT("%2X %2X %2X %2X \r\n",databuf[0],databuf[1],databuf[2],databuf[3]); + + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_HRS, + 0x03, + databuf, + 4); + + } else if(testitem == 0x04) { //打开血氧检测 - g_ble_spo2_timer = osTimerNew((osTimerFunc_t)ble_spo2_check_timer_callback, osTimerPeriodic, NULL, NULL); - osTimerStart(g_ble_spo2_timer,400); - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_SPO2_TEST); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_SINGLE_CHECK_MODE_TEST); + FT_RESULTS_t ft_result = hx3695_factroy_test(SINGLE_CHECK_TEST); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); + uint8_t databuf[4] = {0}; + + databuf[0] = (uint8_t)((ft_result.red_data_final & 0xFF000000) >> 24); + databuf[1] = (uint8_t)((ft_result.red_data_final & 0x00FF0000) >> 16); + databuf[2] = (uint8_t)((ft_result.red_data_final & 0x0000FF00) >> 8); + databuf[3] = (uint8_t)((ft_result.red_data_final & 0x000000FF) >> 0); + + PRINT("%2X %2X %2X %2X \r\n",databuf[0],databuf[1],databuf[2],databuf[3]); + + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_HRS, + 0x04, + databuf, + 4); } else if(testitem == 0x05) { diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index 88a353e7a..905d38cea 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -507,7 +507,7 @@ void cywee_hrs_wearstatus_update(int hrs_data,int wearstatus); void cywee_set_user_info(int user_info[5]); void cywee_get_sleep_data(void); void cywee_reset_daily_data(void); -void cywee_inactivity_mode_change(int mode); +void cywee_inactivity_mode_change(int mode,int enable); void cywee_activity_mode_change(int mode); void cywee_time_sync(void); void cywee_hand_updown_switch(int cmd); @@ -528,6 +528,7 @@ int get_distance_data(void ); void cywee_get_chipinfo(char *databuf,uint8_t len); void cywee_get_acc_switch(uint8_t cmd); void cywee_set_sedentary_interval(int time); + extern uint8_t hrs_mode_state; #pragma pack() diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index 32af17bfb..f79e13f1d 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -337,15 +337,15 @@ static void cywee_service_check_task(void const *arg) break; case CYWEE_SERVICE_CMD_SEDENTARY_MODE: - cywee_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY); + cywee_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY,mail.data[0]); break; case CYWEE_SERVICE_CMD_NAP_MODE: - cywee_inactivity_mode_change(INACTIVITY_MODE_NAP); + cywee_inactivity_mode_change(INACTIVITY_MODE_NAP,mail.data[0]); break; case CYWEE_SERVICE_CMD_SLEEPING_MODE: - cywee_inactivity_mode_change(INACTIVITY_MODE_SLEEPING); + cywee_inactivity_mode_change(INACTIVITY_MODE_SLEEPING,mail.data[0]); break; case CYWEE_SERVICE_CMD_OPEN_HAND_UPDOWN: diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index e2a704a11..8705a79f6 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -255,9 +255,15 @@ void activity_mode_setstatus(int cmd) CWM_SettingControl(SCL_ACTIVITY_PAUSE, &scl); } -void cywee_inactivity_mode_change(int mode) +void cywee_inactivity_mode_change(int mode,int enable) { cywee_time_sync(); + + if(enable == 0) + CWM_Sensor_Disable(IDX_ALGO_INACTIVITY_OUTPUT); + else + CWM_Sensor_Enable(IDX_ALGO_INACTIVITY_OUTPUT); + switch (mode) { //无作用 @@ -991,7 +997,7 @@ int cywee_main_dml(void) // //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); CWM_Sensor_Enable(IDX_ALGO_WATCH_HANDUP); CWM_Sensor_Enable(IDX_ALGO_ACTIVITY_OUTPUT); - CWM_Sensor_Enable(IDX_ALGO_INACTIVITY_OUTPUT); + //CWM_Sensor_Enable(IDX_ALGO_INACTIVITY_OUTPUT); // CWM_Sensor_Enable(IDX_ALGO_SEDENTARY); // CWM_Sensor_Enable(IDX_ALGO_SLEEP); CWM_Sensor_Enable(IDX_ACCEL); diff --git a/code/sdk/drivers/peripheral/mag/mmc5603/mmc5603_main.c b/code/sdk/drivers/peripheral/mag/mmc5603/mmc5603_main.c index d0b3fed0a..55846fa10 100644 --- a/code/sdk/drivers/peripheral/mag/mmc5603/mmc5603_main.c +++ b/code/sdk/drivers/peripheral/mag/mmc5603/mmc5603_main.c @@ -96,6 +96,7 @@ int mmc5603_start(void) { for(i=0;i<4;i++) { + PRINT("saveData[%d] : %f \r\n",i,saveData[i]); mag_hmm[i] = saveData[i]; } } @@ -273,6 +274,8 @@ int SavePara(float *p) int SavePara_infile(float *p,uint32_t len) { + for(int i = 0; i < len ; i++) + PRINT("p[%d] : %f \r\n",i,p[i]); FILE * fp = fopen(MMC_DATA_PATH,"wb"); int ret = 0; if(fp==NULL) diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 77cf75721..a2763bc1f 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -3634,4 +3634,4 @@ void hx3695_lab_test_Int_handle(void) } #endif -#endif //CHIP_HX3695 +#endif //CHIP_HX3695 \ No newline at end of file diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c index 276527e9f..d3b3b95d6 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-13 15:08:38 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-06-13 10:16:15 + * @LastEditTime: 2024-06-17 17:43:19 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c * @Description: * @@ -58,6 +58,8 @@ void ppg_send_cmd_to_driver(char* mode, uint8_t enable) md = FT_LED_OFF_MODE; } else if (strcmp(mode, "wear") == 0) { md = WEAR_MODE; + } else if (strcmp(mode, "single") == 0) { + md = FT_SINGLE_CHECK_MODE; } @@ -70,7 +72,7 @@ void ppg_send_cmd_to_driver(char* mode, uint8_t enable) } else { // ppg_service_running_stat = false; - if(md == HRS_MODE|| md == FT_LEAK_LIGHT_MODE || md == FT_GRAY_CARD_MODE || md == WEAR_MODE) + if(md == HRS_MODE|| md == FT_LEAK_LIGHT_MODE || md == FT_GRAY_CARD_MODE || md == WEAR_MODE || md == FT_SINGLE_CHECK_MODE) { #ifdef HRS_ALG_LIB hx3695_hrs_disable(); diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index 9aa9e1a74..fc13389d5 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -332,6 +332,9 @@ static void ppg_service_check_task(void *arg) }else if (mail == PPG_SERVICE_CMD_TYPE_DO_LED_OFF_MODE_TEST){ cmd = "ledoff"; enable = 0; + }else if (mail == PPG_SERVICE_CMD_TYPE_DO_SINGLE_CHECK_MODE_TEST){ + cmd = "single"; + enable = 1; }else if (mail == PPG_SERVICE_CMD_TYPE_STOP_WEAR_MODE_TEST){ if (keep_in_wear_det_mod == 0) continue; cmd = "wear"; diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h index 965e70d69..bf0e0a19c 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-27 09:07:00 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-06-13 09:42:57 + * @LastEditTime: 2024-06-17 17:46:26 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/service/ppg_service.h * @Description: * @@ -42,6 +42,7 @@ extern "C" { #define PPG_SERVICE_CMD_TYPE_DO_WEAR_MODE_TEST 0x20 #define PPG_SERVICE_CMD_TYPE_STOP_WEAR_MODE_TEST 0x21 #define PPG_SERVICE_CMD_TYPE_DO_LED_OFF_MODE_TEST 0x22 +#define PPG_SERVICE_CMD_TYPE_DO_SINGLE_CHECK_MODE_TEST 0x23 errcode_t uapi_ppg_service_init(void); void uapi_ppg_service_deinit(void); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp index 9107f15c9..04379c523 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp @@ -115,7 +115,7 @@ BootAnimatorListener(){} private: void OnAnimatorStop(OHOS::UIView &view) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnAnimatorStop"); + boot_animation_flag = true; ClearAll(); @@ -130,7 +130,6 @@ private: OHOS::RootView::GetInstance()->Remove(boot_group); delete boot_group; boot_group = nullptr; - boot_animation_flag = true; } }; @@ -147,7 +146,6 @@ static const char ** CreateImagePathsArray(const char *basePath, const char *fil else snprintf(buffer, sizeof(buffer), "%s6S240%d.%s", basePath, i , fileExtension); imagePaths[i] = strdup(buffer); - //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP," imagePaths[%d] = %s ", i, imagePaths[i]); } return imagePaths; } @@ -221,10 +219,6 @@ static void UikitRTCCallBack(uintptr_t data) if (!g_initialized || !g_isScreenOn) { return; } - if(get_printf()) - { - printf("[g_timeInterval is %d ]\r\n",g_timeInterval); - } uapi_rtc_start(g_rtcHandle, g_timeInterval, UikitRTCCallBack, 0); GraphicService::GetInstance()->UpdateGraphicEvent(); } @@ -271,7 +265,6 @@ void NotifyScreenOn(void) OHOS::LowPowerManager::GetInstance()->ExitLowPower(); uapi_rtc_start(g_rtcHandle, g_timeInterval, static_cast(UikitRTCCallBack), 0); } - GraphicService::GetInstance()->NotifyScreenOn(); } @@ -358,7 +351,6 @@ void HideGraphicOtaLogo() static void boot_animation_task(void *arg) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "boot_animation_task start"); unused(arg); boot_group = ReBootAnimatorViewInit(); @@ -375,14 +367,12 @@ static void boot_animation_task(void *arg) }, false); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "boot_animation_task end!!"); } void ShowGraphicLogo(void) { while(boot_animation_flag == false) { - //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowGraphicLogo : %d ",boot_animation_flag); LOS_Mdelay(1); } if (g_showLogo) { @@ -410,7 +400,6 @@ void ShowGraphicOTALogo(void) { while(boot_animation_flag == false) { - //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowGraphicLogo : %d ",boot_animation_flag); LOS_Mdelay(1); } if (g_showOtaLogo) { @@ -448,7 +437,6 @@ void boot_animation_init(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"create boot_animation_task failed %d!",ret); return ; } - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"create boot_animation_task succed"); } #ifdef __cplusplus -- 2.17.1