From ceffafa6a9d9f5c716f62528fe1963ed51f4f8f4 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Thu, 30 May 2024 20:33:30 +0800 Subject: [PATCH] =?utf8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96cywee=20chip?= =?utf8?q?info=E8=93=9D=E7=89=99=E4=BA=A7=E6=B5=8B=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../factorytest_service/factorytest_protocol.c | 13 +++++++++++-- code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h | 1 + code/sdk/drivers/peripheral/cywee/src/main_dml.c | 11 +++++++---- code/sdk/drivers/peripheral/utils/custom_utils.c | 5 +++++ code/sdk/drivers/peripheral/utils/custom_utils.h | 2 +- 5 files changed, 25 insertions(+), 7 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 f13de9001..32bdddaef 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -23,7 +23,6 @@ #include "mag_service.h" #include "nandflash_config.h" #include "string.h" -#include "custom_utils.h" #include "custom_runtime.h" #include "bletest.h" #pragma pack(1) @@ -1009,8 +1008,18 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint 0x06, &send_data, 1); - } + } else if(testitem == 0x07) + { + //获取cywee chipinfo + char chipinfo[64] = {0}; + uapi_cywee_get_chipinfo(chipinfo,sizeof(chipinfo)); + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_ACC, + 0x07, + (uint8_t *)chipinfo, + strlen(chipinfo)); + } break; case BLE_TEST_CMD_SOFT_TEST_SUB_MODE_HRS: diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index e55d199a6..5d7c2a0d7 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -507,6 +507,7 @@ void cywee_hand_updown_switch(int cmd); void cywee_ar_alert_switch(int cmd); void cywee_save_data(void); void step_history_save(void); +void cywee_get_chipinfo(char *databuf,uint8_t len); extern uint8_t hrs_mode_state; #pragma pack() diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index ab21c9ad5..a03e7f53b 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -46,13 +46,19 @@ static int stepcount = 0; int history_step_=0;//存一个小时前的步数数据,每次保存步数时会更新改数据 +static char chipInfo[64] = {0}; + int cm__hs1__init(void); int cm__hs1__deinit(void); +void cywee_get_chipinfo(char *databuf,uint8_t len) +{ + memcpy_s(databuf,len,chipInfo,strlen(chipInfo)); +} + void cywee_save_data(void) { CWM_OS_saveData(&stepcount,sizeof(int)); - } void step_history_save(void) @@ -68,7 +74,6 @@ void cywee_ar_alert_switch(int cmd) CWM_SettingControl(SCL_AR_ALERT_CONFIG, &scl); } - void cywee_hand_updown_switch(int cmd) { if(cmd == 1) @@ -779,8 +784,6 @@ int cywee_main_dml(void) #endif //get chip information - char chipInfo[64]; - memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; scl.iData[1] = 1; diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 3727f727e..822e32f48 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -1855,6 +1855,11 @@ void uapi_cywee_get_id(void) PRINT("cywee id : 0x%X \r\n",id); } +void uapi_cywee_get_chipinfo(char *databuf,uint8_t len) +{ + cywee_get_chipinfo(databuf,len); +} + #ifdef SUPPORT_ALIPAY_SEC #include "alipay_feature.h" int custom_exit_lpm(void) diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index c5ae6a7e0..2098b2f02 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -177,7 +177,7 @@ int custom_exit_lpm(void); void uapi_cywee_get_sleep_data(void); void uapi_cywee_set_user_info(int user_info[5]); void uapi_cywee_time_sync(void); - +void uapi_cywee_get_chipinfo(char *databuf,uint8_t len); #include "custom_utilscpp.h" -- 2.17.1