From 5bb57ab058f85af7d37766e9235c88b2c834ab22 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Sat, 22 Jun 2024 15:29:23 +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=B7=BB=E5=8A=A0=E5=A4=A9=E7=BA=BF=E6=B5=8B?= =?utf8?q?=E8=AF=95=E8=93=9D=E7=89=99=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../factorytest_protocol.c | 67 +++++++++++++++++-- .../drivers/peripheral/cywee/Inc/cywee_hal.h | 1 + .../peripheral/cywee/Inc/cywee_service.h | 6 +- .../peripheral/cywee/service/cywee_service.c | 9 +++ .../drivers/peripheral/cywee/src/main_dml.c | 18 +++-- .../drivers/peripheral/ppg/hx3695/hx3695.c | 5 +- .../peripheral/ppg/service/ppg_service.cpp | 3 +- 7 files changed, 92 insertions(+), 17 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 71a2fb856..206377026 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-06-20 15:31:42 + * @LastEditTime: 2024-06-22 15:27:12 * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c * @Description: * @@ -1498,9 +1498,7 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint 0x08, &send_data, 1); - } - - else if(testitem == 0x09) + } else if(testitem == 0x09) { //挂断电话 uint8_t send_data = 0x00; @@ -1511,6 +1509,67 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint 0x09, &send_data, 1); + } else if(testitem == 0x10) + { + //获取校准信息 + uint8_t send_data = 0; + cat1_at_cmd("at*mrd_cdf=Q,LteCalData.nvm"); + LOS_Msleep(500); + ble_get_cat1_at_msg((char *)&send_data,1); + if(atol(send_data) == 1) + send_data = 1; + else + send_data = 0; + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CAT1, + 0x10, + &send_data, + 1); + } else if(testitem == 0x11) + { + //设置强收模式 + uint8_t send_data = 0; + cat1_at_cmd("at+QRFTESTMODE=1"); + LOS_Msleep(500); + ble_get_cat1_at_msg((char *)&send_data,1); + if(atol(send_data) == 0) + send_data = 1; + else + send_data = 0; + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CAT1, + 0x11, + &send_data, + 1); + } else if(testitem == 0x12) + { + //查询信号值 + char buf[20] = {0}; + cat1_at_cmd("AT+QRXFTM=\"LTE BAND1\",300,\"on\",75"); + LOS_Msleep(500); + ble_get_cat1_at_msg(buf,20); + PRINT("AT+QRXFTM buf : %s \r\n",buf); + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CAT1, + 0x12, + (uint8_t *)buf, + strlen(buf)); + } else if(testitem == 0x13) + { + //关闭强接受 + uint8_t send_data = 0; + cat1_at_cmd("AT+QRXFTM=\"LTE BAND1\",300,\"off\",75"); + LOS_Msleep(500); + ble_get_cat1_at_msg((char *)&send_data,1); + if(atol(send_data) == 0) + send_data = 1; + else + send_data = 0; + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CAT1, + 0x13, + &send_data, + 1); } break; diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index 35b5b543b..0b9393e20 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -536,6 +536,7 @@ void set_fat_time_data(void); void cywee_get_chipinfo(char *databuf,uint8_t len); void cywee_set_sedentary_interval(int time); +void cywee_get_acc_switch(int cmd); extern uint8_t hrs_mode_state; diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h index 4f88d5478..9b8e51bc0 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-26 20:29:58 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-06-21 20:06:06 + * @LastEditTime: 2024-06-22 15:03:56 * @FilePath: /FD230/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h * @Description: * @@ -82,6 +82,10 @@ extern "C" { #define CYWEE_SERVICE_CMD_SET_USER_INFO 0x2E +#define CYWEE_SERVICE_CMD_OPEN_GET_ACC 0x2F + +#define CYWEE_SERVICE_CMD_CLOSE_GET_ACC 0x30 + errcode_t uapi_cywee_service_init(void); void uapi_cywee_service_deinit(void); diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index 0368f948f..55890a72a 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -387,6 +387,15 @@ static void cywee_service_check_task(void const *arg) case CYWEE_SERVICE_CMD_SET_USER_INFO: cywee_set_user_info(); break; + + case CYWEE_SERVICE_CMD_OPEN_GET_ACC: + cywee_get_acc_switch(1); + break; + + case CYWEE_SERVICE_CMD_CLOSE_GET_ACC: + cywee_get_acc_switch(0); + break; + default: PRINT("unkonw cmd \r\n"); break; diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 48622975b..36e8b06b6 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -73,6 +73,11 @@ static int sedentary_interval_count = 0; int cm__hs1__init(void); int cm__hs1__deinit(void); +void cywee_get_acc_switch(int cmd) +{ + get_acc_swtich = cmd; +} + void cywee_set_sedentary_interval(int time) { sedentary_interval = time; @@ -303,13 +308,11 @@ void activity_mode_setstatus(int cmd) { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_TEST); hrs_mode_state = 1; - get_acc_swtich = 1; } else { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); hrs_mode_state = 0; - get_acc_swtich = 0; } } @@ -583,13 +586,11 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_TEST); hrs_mode_state = 1; - get_acc_swtich = 1; } else { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); hrs_mode_state = 0; - get_acc_swtich = 0; } } break; @@ -1009,28 +1010,31 @@ int cywee_main_dml(void) scl.iData[4] = 1;//extra info发送 0 打开,1关闭 CWM_SettingControl(SCL_PEDO_CONFIG, &scl); + //设置运动模式 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; CWM_SettingControl(SCL_ACTIVITY_CONFIG, &scl); - + //设置睡眠 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; CWM_SettingControl(SCL_SLEEP_CONFIG, &scl); - + //设置久坐 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; scl.iData[2] = 1; CWM_SettingControl(SCL_SEDENTARY, &scl); + //设置静态模式 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; CWM_SettingControl(SCL_INACTIVITY_CONFIG, &scl); + //设置运动识别 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; - scl.iData[1] = 1; + scl.iData[1] = 1;// 0 关闭运动识别 1 打开运动识别 CWM_SettingControl(SCL_AR_ALERT_CONFIG, &scl); // memset(&scl, 0, sizeof(scl)); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index fd72614ce..da23b2020 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2754,10 +2754,7 @@ void hx3695_hrs_ppg_Int_handle(void) { memset(gsensordata,0.0f,sizeof(gsenson_t) * 8); - if(hrs_mode_state == 1) - { - gsensor_get_n_data(8,gsensordata); - } + gsensor_get_n_data(8,gsensordata); for(ii=0; ii<*count; ii++) { diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index d2d1b910e..327194f8b 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -309,7 +309,7 @@ static void ppg_service_check_task(void *arg) wear_mode_timeout_handler(NULL); continue; }else if (mail == PPG_SERVICE_CMD_TYPE_DO_PPG_TEST){ - + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_OPEN_GET_ACC,NULL); cmd = "hrs"; enable = 1; uapi_pm_add_sleep_veto(PM_ID_HEART); @@ -342,6 +342,7 @@ static void ppg_service_check_task(void *arg) enable = 0; wear_mode_state = 0; }else if (mail == PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST){ + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CLOSE_GET_ACC,NULL); cmd = "hrs"; enable = 0; uapi_pm_remove_sleep_veto(PM_ID_HEART); -- 2.17.1