From 4cfc17c2a8baf8e129030421b1bc0d9fa1092a50 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BD=AD=E7=A3=8A?= <1624952103@qq.com> Date: Thu, 13 Jun 2024 06:14:10 +0000 Subject: [PATCH] Merge #271 into sdk602patch0521 from refs/changes/271/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 优化蓝牙产测,添加ppg关闭led指令 * refs/changes/271/head: (1 commits squashed) - 优化蓝牙产测,添加ppg关闭led指令 Signed-off-by: aliyun6865282430 <1624952103@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/271 --- .../factorytest_service/factorytest_protocol.c | 14 +++++++++++--- code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c | 1 + .../sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c | 5 ++--- .../drivers/peripheral/ppg/service/ppg_service.cpp | 6 ++++-- .../drivers/peripheral/ppg/service/ppg_service.h | 3 ++- 5 files changed, 20 insertions(+), 9 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 0beb7e92e..de9e3e390 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -277,6 +277,8 @@ void ble_microhone_check_timer_callback(void) uapi_microhone_switch(0); + osTimerStop(g_ble_microhone_timer); + osTimerDelete(g_ble_microhone_timer); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_SPEAKER, 0x01, @@ -290,7 +292,8 @@ void ble_spk_check_timer_callback(void) uint8_t send_data= 0; uapi_check_spk(0); - + osTimerStop(g_ble_spk_timer); + osTimerDelete(g_ble_spk_timer); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_SPEAKER, 0x02, @@ -809,7 +812,12 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint //写入RTC uint8_t send_data = 0x00; - set_system_time((char *)data); + uint32_t timestamp = (data[0] & 0XFF) << 24 | + (data[1] & 0XFF) << 16 | + (data[2] & 0XFF) << 8 | + (data[3] & 0XFF) << 0 ; + PRINT("rtc set time : %X \r\n",timestamp); + uaip_set_time_local(timestamp); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_RTC, 0x01, @@ -1196,7 +1204,7 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint { //关闭所有LED uint8_t send_data = 0x00; - send_ppg_cmd_msg("ledoff"); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_LED_OFF_MODE_TEST); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_HRS, 0x02, diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 6fc1c9636..9e5320690 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2376,6 +2376,7 @@ bool hx3695_init(WORK_MODE_T mode) break; case FT_LED_OFF_MODE: + TYHX_LOG(" hx3695_init mode : FT_LED_OFF_MODE \n"); hx3695_factroy_test(LED_OFF_TEST); break; diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c index 613a60634..276527e9f 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-05-10 12:19:56 + * @LastEditTime: 2024-06-13 10:16:15 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c * @Description: * @@ -61,8 +61,7 @@ void ppg_send_cmd_to_driver(char* mode, uint8_t enable) } - if (enable == 1) { - + if (enable == 1 || md == FT_LED_OFF_MODE) { // ppg_service_running_stat = true; uapi_pm_control(PM_APP_WAKE_NEEDED); tyhx_poweron(); diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index fdbeae3ed..ac3d3cbc5 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -329,8 +329,10 @@ static void ppg_service_check_task(void *arg) cmd = "wear"; enable = 1; wear_mode_state = 1; - } - else if (mail == PPG_SERVICE_CMD_TYPE_STOP_WEAR_MODE_TEST){ + }else if (mail == PPG_SERVICE_CMD_TYPE_DO_LED_OFF_MODE_TEST){ + cmd = "ledoff"; + enable = 0; + }else if (mail == PPG_SERVICE_CMD_TYPE_STOP_WEAR_MODE_TEST){ if (keep_in_wear_det_mod == 0) continue; cmd = "wear"; enable = 0; diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.h b/code/sdk/drivers/peripheral/ppg/service/ppg_service.h index 513c2ed38..965e70d69 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-04-22 10:43:36 + * @LastEditTime: 2024-06-13 09:42:57 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/service/ppg_service.h * @Description: * @@ -41,6 +41,7 @@ extern "C" { #define PPG_SERVICE_CMD_TYPE_STOP_SPO2_TEST 0x1F #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 errcode_t uapi_ppg_service_init(void); void uapi_ppg_service_deinit(void); -- 2.17.1