From b09c183d28d6bd554d9e563f840ce49b574e3718 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BD=AD=E7=A3=8A?= <1624952103@qq.com> Date: Mon, 21 Oct 2024 02:19:27 +0000 Subject: [PATCH] Merge #1228 into sdk602patch0911 from refs/changes/1228/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 优化小睡数据存储 * refs/changes/1228/head: (2 commits squashed) - 优化小睡数据存储 - 优化蓝牙产测老化测试,按键测试 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/1228 --- .../producttest/src/testmicrophone.cpp | 6 +- .../factorytest_protocol.c | 107 ++++++++++++------ .../drivers/peripheral/cywee/src/main_dml.c | 15 ++- .../drivers/peripheral/utils/custom_utils.c | 48 +++++++- 4 files changed, 133 insertions(+), 43 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp index 103088db6..e94213556 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp @@ -312,12 +312,14 @@ extern "C" if(isopen) { // AlarmClockModel::GetInstance()->testPlayerStart("/user/userdata/microphone.mp3"); - FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/user/userdata/microphone.mp3"); + // FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/user/userdata/microphone.mp3"); + AlarmClockModel::GetInstance()->AlarmPlayerStart(); } else { // AlarmClockModel::GetInstance()->AlarmPlayerStop(); - FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); + // FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); + AlarmClockModel::GetInstance()->AlarmPlayerStop(); } } 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 56ee2aaf1..489c04daf 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-10-12 20:34:45 + * @LastEditTime: 2024-10-20 18:54:23 * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c * @Description: * @@ -41,6 +41,8 @@ #ifdef SUPPORT_TCPIP #include "lwip/api_shell.h" #endif +#include "input_app.h" +#include "PhoneServiceC.h" #pragma pack(1) typedef struct factorytest_cmd_header_t @@ -171,6 +173,7 @@ void aging_task(void) while(aging_t.flag == 0xfdfd0002 && aging_time) //while(aging_t.flag == 0xfdfd0002) { + int cmd = 0; uint32_t msc; uapi_get_timestampe_ss(&msc); aging_t.enter_age_time = msc; @@ -195,6 +198,9 @@ void aging_task(void) } } +/*********************LCD 老化测试*****************************/ + + //读LCD ID uint32_t id; lcd_getid(&id); if(id != 0x1133) @@ -202,22 +208,19 @@ void aging_task(void) aging_t.display_error++; aging_t.fail_num++; } - mcu_pm_lcd_on(0,0); - mcu_pm_lcd_off(0,0); PRINT("aging_t.display_error : %d \r\n",aging_t.display_error); - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_GRAYCARD_TEST); - FT_RESULTS_t ft_result = hx3695_factroy_test(LEAK_LIGHT_TEST); - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); - - if(ft_result.gr_data_final < 10000 || ft_result.red_data_final < 10000 || ft_result.ir_data_final < 10000) + //单色屏测试 + cmd = 1; + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_TEST,&cmd,sizeof(cmd)); + for(cmd = 1; cmd < 6 ; cmd++) { - aging_t.ppg_error++; - aging_t.fail_num++; + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_COLOR_TEST,&cmd,sizeof(cmd)); + LOS_Msleep(1000); } - - PRINT("aging_t.ppg_error : %d \r\n",aging_t.ppg_error); - + +/*********************TP 老化测试*****************************/ + //读TP ID uint16_t tp_id; touch_getid(&tp_id); if(tp_id != 0x6456) @@ -227,6 +230,35 @@ void aging_task(void) } PRINT("aging_t.tp_error : %d \r\n",aging_t.tp_error); +/********************* 马达 老化测试*****************************/ + //震6秒 + for(cmd = 0; cmd < 2 ; cmd++) + { + // ui_api_vibrate_once_func(3); + ui_api_vibrate_once_func(); + LOS_Msleep(1000); + } + PRINT("aging_t.motor_error : %d \r\n",aging_t.motor_error); +/********************* spk 老化测试*****************************/ + uapi_check_spk(1); + LOS_Msleep(2000); + uapi_check_spk(0); + aging_t.speaker_error = 0; + PRINT("aging_t.speaker_error : %d \r\n",aging_t.speaker_error); +/*********************ppg 老化测试*****************************/ + //漏光测试 + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_GRAYCARD_TEST); + FT_RESULTS_t ft_result = hx3695_factroy_test(LEAK_LIGHT_TEST); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); + + if(ft_result.gr_data_final > 5000 || ft_result.red_data_final > 5000 || ft_result.ir_data_final > 5000) + { + aging_t.ppg_error++; + aging_t.fail_num++; + } + PRINT("aging_t.ppg_error : %d \r\n",aging_t.ppg_error); + +/*********************gsensor 老化测试*****************************/ gsenson_t g; get_gsonsen_xyz(&g); if(g.x == 0 && g.y == 0 && g.z == 0) @@ -236,6 +268,7 @@ void aging_task(void) } PRINT("aging_t.gsensor_error : %d \r\n",aging_t.gsensor_error); +/*********************磁力计 老化测试*****************************/ float fAzimuth,fPitch,fRoll; mmc5603_getdata(&fAzimuth,&fPitch,&fRoll); if(fAzimuth < 0) @@ -245,13 +278,6 @@ void aging_task(void) } PRINT("aging_t.mag_error : %d \r\n",aging_t.mag_error); - // uapi_vibrationModeSet(3); - ui_api_vibrate_once_func(); - aging_t.motor_error = 0; - PRINT("aging_t.motor_error : %d \r\n",aging_t.motor_error); - - aging_t.speaker_error = 0; - PRINT("aging_t.speaker_error : %d \r\n",aging_t.speaker_error); uint32_t flash_id; flash_getid(&flash_id); @@ -572,6 +598,17 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint &send_data, 1); } + if (testitem == 0x06) + { + uint8_t send_data = 0x00; + uapi_hfp_connect_(); + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_BLE, + 0x06, + &send_data, + 1); + } + break; case BLE_TEST_CMD_SOFT_TEST_SUB_MODE_VIBRATOR: @@ -650,9 +687,12 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint //开启电源键测试 uint8_t send_data = 0; - uapi_button_register_event_cb(pwr_button_callback_press, 1); - uapi_button_register_event_cb(pwr_button_callback_click_2, 3); - uapi_button_register_event_cb(pwr_button_callback_long_press_2s, 5); + uapi_button_unregister_event_cb(BUTTON_PWR_CLICKUP_2); + uapi_button_unregister_event_cb( BUTTON_PWR_LONGPRESS_2S); + + uapi_button_register_event_cb(pwr_button_callback_press, BUTTON_PWR_CLICKUP); + uapi_button_register_event_cb(pwr_button_callback_click_2, BUTTON_PWR_CLICKUP_2); + uapi_button_register_event_cb(pwr_button_callback_long_press_2s, BUTTON_PWR_LONGPRESS_2S); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_KEY, @@ -664,9 +704,12 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint //开启功能键测试 uint8_t send_data = 0; - uapi_button_register_event_cb(func_button_callback_press, 24); - uapi_button_register_event_cb(func_button_callback_click_2, 26); - uapi_button_register_event_cb(func_button_callback_long_press_2s, 28); + uapi_button_unregister_event_cb(BUTTON1_CLICKUP_2); + uapi_button_unregister_event_cb(BUTTON1_LONGPRESS_2S); + + uapi_button_register_event_cb(func_button_callback_press, BUTTON1_CLICKUP); + uapi_button_register_event_cb(func_button_callback_click_2, BUTTON1_CLICKUP_2); + uapi_button_register_event_cb(func_button_callback_long_press_2s, BUTTON1_LONGPRESS_2S); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_KEY, @@ -1254,7 +1297,7 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint { //漏光测试 send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_LEAKLIGHT_TEST); - LOS_Msleep(500); + LOS_Msleep(200); FT_RESULTS_t ft_result = hx3695_factroy_test(LEAK_LIGHT_TEST); send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); uint8_t databuf[12] = {0}; @@ -1274,11 +1317,11 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint databuf[10] = (uint8_t)((ft_result.ir_data_final & 0x0000FF00) >> 8); databuf[11] = (uint8_t)((ft_result.ir_data_final & 0x000000FF) >> 0); - PRINT("%2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X\r\n", - databuf[0],databuf[1],databuf[2],databuf[3], - databuf[4],databuf[5],databuf[6],databuf[7], - databuf[8],databuf[9],databuf[10],databuf[11] - ); + // PRINT("%2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X\r\n", + // databuf[0],databuf[1],databuf[2],databuf[3], + // databuf[4],databuf[5],databuf[6],databuf[7], + // databuf[8],databuf[9],databuf[10],databuf[11] + // ); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_HRS, diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 8c6c634d3..5bee5e31a 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -150,10 +150,18 @@ void clean_sleep_data(void) void cywee_save_nap_data(cywee_inactivity_accumulate_time_t c_inactivity_accumulate_time_t) { - char day[12] = {0}; - uapi_get_YYMMDD_Time(day, '\0'); + if (access(nap_file_path, 0) == -1) //如果小睡文件不存在,创建睡眠文件夹 + { + memset(dir_path,0,sizeof(dir_path)); + memset(day,0,sizeof(day)); + memset(nap_file_path,0,sizeof(nap_file_path)); + + uapi_get_YYMMDD_Time(day, '\0'); + sprintf_s(dir_path, 64, SLEEP_DIR_PATH, day); + uapi_create_folder(dir_path); + sprintf_s(nap_file_path, 64, NAP_PATH, day); + } - sprintf_s(nap_file_path, 64, NAP_PATH, day); uint32_t size = uapi_get_file_size(nap_file_path); @@ -756,7 +764,6 @@ void cywee_time_sync(void) uapi_get_YYMMDD_Time_extend(day, '\0', 0); sprintf_s(dir_path, 64, SLEEP_DIR_PATH, day); - uapi_create_folder("user/userdata/sleep"); uapi_create_folder(dir_path); } diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index ee4e0ee5f..f7cc52571 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -2872,18 +2872,56 @@ void uapi_vibrator_test(uint32_t test_time) } } -void uapi_create_folder(char *dir_path) +//创建指定路径文件夹 +void uapi_create_folder(char *dir_path) { + if(dir_path == NULL) + return; + + char *path_copy = strdup(dir_path); + char *token; + char *saveptr; + + token = strtok_r(path_copy, "/", &saveptr); + if (token == NULL) + { + free(path_copy); + return; + } + + char current_path[256] = ""; + strcat(current_path, token); + strcat(current_path, "/"); + struct stat info; - if (stat(dir_path, &info) != 0) + if (stat(current_path, &info)!= 0) + { + if (mkdir(current_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)!= 0) + { + PRINT("mkdir %s failed\n", current_path); + free(path_copy); + return; + } + } + + while ((token = strtok_r(NULL, "/", &saveptr))!= NULL) { - if(mkdir(dir_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) + strcat(current_path, token); + strcat(current_path, "/"); + if (stat(current_path, &info)!= 0) { - PRINT("mkdir %s failed \n",dir_path); + if (mkdir(current_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)!= 0) + { + PRINT("mkdir %s failed\n", current_path); + free(path_copy); + return; + } } } -} + free(path_copy); + PRINT("mkdir %s succed\n", dir_path); +} //获取小睡数据长度(协议用) uint32_t uapi_get_file_size(char *filepath) -- 2.17.1