From 9de5cef5295161739e891d704a77b36d59d06c3e Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Thu, 11 Dec 2025 09:44:14 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96272=E8=A1=A8=E5=86=A0=E6=A0=A1?= =?utf8?q?=E5=87=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../drivers/rotary_encoder/hx3508/hx3508.c | 7 +++++++ .../drivers/rotary_encoder/hx3508/hx3508.h | 1 + .../factorytest_protocol.c | 20 +++++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/code/sdk/zhihui/drivers/rotary_encoder/hx3508/hx3508.c b/code/sdk/zhihui/drivers/rotary_encoder/hx3508/hx3508.c index fae95df27..7105816c9 100644 --- a/code/sdk/zhihui/drivers/rotary_encoder/hx3508/hx3508.c +++ b/code/sdk/zhihui/drivers/rotary_encoder/hx3508/hx3508.c @@ -110,6 +110,13 @@ void hx3508_set_coffy(float data) uapi_save_file_data(COFFY_PATH,&coffy,4,"w"); } +void hx3508_clean_coffy(void) +{ + coffy = 1.0f; + uapi_delete_files(COFFY_PATH); +} + + static void hx3508_get_coffy(void) { float data = 0.0f; diff --git a/code/sdk/zhihui/drivers/rotary_encoder/hx3508/hx3508.h b/code/sdk/zhihui/drivers/rotary_encoder/hx3508/hx3508.h index 0a37a1f9e..8c27f95e2 100644 --- a/code/sdk/zhihui/drivers/rotary_encoder/hx3508/hx3508.h +++ b/code/sdk/zhihui/drivers/rotary_encoder/hx3508/hx3508.h @@ -194,5 +194,6 @@ void hx3508_open(void); void hx3508_set_factory_test_mode(uint8_t cmd); void hx3508_set_coffy(float data); void hx3508_get_sum_y(float *data); +void hx3508_clean_coffy(void); #endif //_TYHX__OTS_hx3508_CUSTOM_H diff --git a/code/sdk/zhihui/services/factorytest_service/factorytest_protocol.c b/code/sdk/zhihui/services/factorytest_service/factorytest_protocol.c index 29badcaae..9fed55363 100644 --- a/code/sdk/zhihui/services/factorytest_service/factorytest_protocol.c +++ b/code/sdk/zhihui/services/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: 2025-12-10 15:36:21 + * @LastEditTime: 2025-12-11 09:43:55 * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c * @Description: * @@ -1241,12 +1241,11 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint { //获取表冠ID uint8_t send_data[2] = {0}; -#ifdef ROTARYENCODER_HX3508 - uint16_t crown_id =0; + uint16_t crown_id = 0; rotary_get_chip_id(&crown_id); send_data[0] = (uint8_t)(((uint16_t)crown_id & 0xFF00) >> 8); send_data[1] = (uint8_t)((uint16_t)crown_id & 0x00FF); -#endif + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_KEY, 0x08, @@ -1308,6 +1307,19 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint &send_data, 1); } + else if(testitem == 0x0C) + { + //清除校准参数 + uint8_t send_data = 0; +#ifdef ROTARYENCODER_HX3508 + hx3508_clean_coffy(); +#endif + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_KEY, + 0x0C, + &send_data, + 1); + } break; -- 2.17.1