From b6c97106765c3cf079cac819540b3107464344c5 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Wed, 30 Oct 2024 18:39:32 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8Dgsensor=E5=9C=A8=E8=A7=86?= =?utf8?q?=E9=A2=91=E8=A1=A8=E7=9B=98=E4=B8=8B=E5=81=9C=E6=AD=A2=E7=9A=84b?= =?utf8?q?ug=20=E4=BC=98=E5=8C=96=E8=93=9D=E7=89=99=E4=BA=A7=E6=B5=8B?= =?utf8?q?=E8=80=81=E5=8C=96=E6=B5=8B=E8=AF=95=20=E9=99=8D=E4=BD=8E?= =?utf8?q?=E8=93=9D=E7=89=99=E9=80=9A=E8=AF=9D=E9=9F=B3=E9=87=8F=20?= =?utf8?q?=E9=98=B2=E6=AD=A2=E7=A0=B4=E9=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../config/aw88166/mono/16bit/aw_params.h | 8 +- .../src/AlarmClockTimerConfig.cpp | 11 ++- .../nativeui/producttest/src/testView.cpp | 5 +- .../factorytest_protocol.c | 97 +++++++++++-------- .../drivers/peripheral/utils/custom_utils.c | 8 ++ 5 files changed, 81 insertions(+), 48 deletions(-) diff --git a/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/16bit/aw_params.h b/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/16bit/aw_params.h index e3f9f7771..5666ae228 100755 --- a/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/16bit/aw_params.h +++ b/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/16bit/aw_params.h @@ -562,8 +562,8 @@ const unsigned char dev0_Receiver_dsp_cfg[] = { 0x0d,0x0d,0x0d,0x0d,0x0c,0x0c,0x0b,0x0b,0x0a,0x0a,0x0a,0x0a,0xd5,0x00,0x03,0x00, 0x03,0x00,0x00,0x55,0x06,0xce,0x00,0x00,0x04,0x8a,0x00,0x00,0xd5,0x00,0x00,0x00, 0x02,0x80,0x00,0x00,0x06,0xce,0x00,0x00,0x06,0xce,0x00,0x00,0xd5,0x00,0x03,0x00, -0x03,0x00,0x00,0x55,0x06,0xce,0x00,0x00,0x04,0x8a,0x00,0x00,0xd8,0x00,0x0b,0x00, -0x06,0x00,0x00,0x4e,0x00,0xaf,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x0c,0x00,0x00, +0x03,0x00,0x00,0x55,0x06,0xce,0x00,0x00,0x04,0x8a,0x00,0x00,0xd8,0x00,0x0a,0x00, +0x06,0x00,0x00,0x47,0x00,0xaf,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x0c,0x00,0x00, 0xfe,0xab,0x02,0x80,0xff,0xde,0xf5,0x00,0x00,0x3c,0x00,0x00,0x11,0x11,0x00,0x01, 0x00,0x1e,0x00,0x00,0xee,0xef,0xff,0xfe,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xc9,0x02,0xb8,0x02,0xa7,0x02,0x96, @@ -580,8 +580,8 @@ const unsigned char dev0_Receiver_dsp_cfg[] = { 0x3b,0x53,0x00,0x00,0xbb,0x3d,0x03,0xe0,0x57,0x78,0xfe,0x1e,0x58,0x36,0x01,0xfa, 0x4f,0x94,0xfc,0x0b,0x58,0x36,0x01,0xfa,0xa0,0x6e,0x03,0xf4,0x3f,0x96,0xfe,0x0b, 0x00,0x0a,0x00,0x1b,0x05,0xdc,0x00,0x00,0x00,0x0a,0x00,0x16,0x02,0xee,0x00,0x00, -0x00,0x0f,0x00,0xc9,0x06,0x24,0x00,0x01,0x0f,0xac,0x00,0x00,0xf5,0xd0,0xc5,0x4a, -0x32,0xe2,0xd3,0x45, +0x00,0x0f,0x00,0xc9,0x06,0x24,0x00,0x01,0x0f,0xac,0x00,0x00,0xf5,0xd0,0x36,0x33, +0x58,0xd5,0xb8,0x1c, }; struct aw_prof_desc g_dev0_prof[] = { diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp index 74607afc2..b9306d016 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -356,10 +356,15 @@ extern "C" return; } - if (curTime.tm_sec % 3 == 0) { + if (curTime.tm_sec % 3 == 0) + { do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_BLE_ADV_CHECK, nullptr, 0); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CHECK_ACC,NULL); //检查gsensor是否停止 - } + } + + if(curTime.tm_sec % 60 == 0) + { + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CHECK_ACC,NULL); //一分钟检查一次gsensor是否停止 + } if (g_alarmCtrA.state == ALARM_STATUS_RUNNING) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp index 91776c5ff..fc15f5592 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp @@ -6,7 +6,7 @@ #include "cat1_ctl.h" #include "cat1_server_hal.h" #include "custom_utils.h" - +#include "custom_runtime.h" namespace OHOS { @@ -805,7 +805,8 @@ namespace OHOS } display_api->set_auto_timeout_function(false); - uapi_set4GCapability(true); + if(!uapi_dev_runtime_get_factory_test_status_flag()) + uapi_set4GCapability(true); start_custom_ble_service(); } 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 ff4dab7c4..ad332921c 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-30 10:48:57 + * @LastEditTime: 2024-10-30 18:37:04 * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c * @Description: * @@ -63,6 +63,7 @@ typedef struct uint32_t fail_num; //总失败次数 uint32_t display_error; //LCD失败次数 uint32_t tp_error; //tp失败次数 + uint32_t crown_error; //表冠失败次数 uint32_t gsensor_error; //gsensor失败次数 uint32_t ppg_error; //ppg失败次数 uint32_t mag_error; //磁力计失败次数 @@ -82,7 +83,7 @@ static osTimerId_t g_ble_vibrator_timer = NULL; static osTimerId_t g_ble_acc_timer = NULL; -static uint32_t aging_time = 0; +static int aging_time = 0; static uint8_t pwr_button_result = 0; static uint8_t func_button_result = 1; @@ -170,11 +171,12 @@ void aging_task(void) uint32_t enter_age_time = 0; uint32_t exit_age_time = 0; int cmd = 0; - while(aging_t.flag == 0xfdfd0002 && aging_time) + while(aging_t.flag == 0xfdfd0002) //while(aging_t.flag == 0xfdfd0002) { uapi_get_timestampe_ss(&enter_age_time); + aging_t.left_time = aging_time; PRINT("老化目标时间 : %d \r\n",aging_t.target_time); PRINT("老化剩余时间 : %d \r\n",aging_t.left_time); @@ -221,30 +223,43 @@ void aging_task(void) } PRINT("TP 失败次数 : %d \r\n",aging_t.tp_error); +/*********************表冠 老化测试*****************************/ + //读crown ID + PRINT("crown_read_reg : %X \n",crown_read_reg(0x00)); + if(!(crown_read_reg(0x00) == 0x30)) + { + aging_t.crown_error++; + aging_t.fail_num++; + } + PRINT("表冠 失败次数 : %d \r\n",aging_t.crown_error); + + /*********************充电 老化测试*****************************/ bool state; state = uapi_get_charger_plug_status(); - if(!state) + PRINT("充电 uapi_get_charger_plug_status() : %d \r\n",uapi_get_charger_plug_status()); + if(!uapi_get_charger_plug_status()) { aging_t.charge_error++; aging_t.fail_num++; } - PRINT("充电 失败次数 : %d \r\n",aging_t.tp_error); + PRINT("充电 失败次数 : %d \r\n",aging_t.charge_error); /********************* 马达 老化测试*****************************/ //2min 震2s 停2s uint32_t total_time = 2 * 60; uint32_t enter_time = 0; uint32_t age_time = 0; - while(total_time) + uint32_t current_time = 0; + uapi_get_timestampe_ss(&enter_time); + do { - uapi_get_timestampe_ss(&enter_time); + uapi_get_timestampe_ss(¤t_time); + // uapi_get_timestampe_ss(&enter_time); custom_VibratorFunc_int(4); LOS_Msleep(4000); - uapi_get_timestampe_ss(&age_time); - total_time -= (age_time - enter_time); - PRINT("total_time[%d]\n",total_time); - } - uapi_vibrator_test(); + // uapi_get_timestampe_ss(&age_time); + PRINT("current_time - enter_time[%d]\n",current_time - enter_time); + }while(current_time - enter_time <= 2 * 60); PRINT("马达失败次数 : %d \r\n",aging_t.motor_error); /********************* mic 老化测试*****************************/ @@ -257,40 +272,45 @@ void aging_task(void) aging_t.fail_num++; } PRINT("mic失败次数 : %d \r\n",aging_t.mic_error); + uapi_delete_files("/user/userdata/microphone.mp3"); /********************* spk 老化测试*****************************/ total_time = 2 * 60; enter_time = 0; age_time = 0; - while(total_time) + uapi_get_timestampe_ss(&enter_time); + do { - uapi_get_timestampe_ss(&enter_time); + uapi_get_timestampe_ss(¤t_time); uapi_check_spk(1); LOS_Msleep(2000); uapi_check_spk(0); aging_t.speaker_error = 0; - uapi_get_timestampe_ss(&age_time); - total_time -= (age_time - enter_time); - PRINT("total_time[%d]\n",total_time); - } + PRINT("current_time - enter_time[%d]\n",current_time - enter_time); + }while(current_time - enter_time <= 2 * 60); PRINT("spk失败次数 : %d \r\n",aging_t.speaker_error); /*********************ppg 老化测试*****************************/ total_time = 2 * 60; enter_time = 0; age_time = 0; - while(total_time) + uapi_get_timestampe_ss(&enter_time); + do { - uapi_get_timestampe_ss(&enter_time); + uapi_get_timestampe_ss(¤t_time); send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_SINGLE_CHECK_MODE_TEST); LOS_Msleep(200); FT_RESULTS_t ft_result = hx3695_factroy_test(SINGLE_CHECK_TEST); send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); PRINT("ft_result.gr_data_final : %d , ft_result.red_data_final : %d , ft_result.ir_data_final : %d\r\n",ft_result.gr_data_final,ft_result.red_data_final,ft_result.ir_data_final); - uapi_get_timestampe_ss(&age_time); - total_time -= (age_time - enter_time); - PRINT("total_time[%d]\n",total_time); - } + if(!(ft_result.gr_data_final && ft_result.red_data_final && ft_result.ir_data_final)) + { + aging_t.ppg_error++; + aging_t.fail_num++; + } + PRINT("current_time - enter_time[%d]\n",current_time - enter_time); + }while(current_time - enter_time <= 2 * 60); + PRINT("aging_t.ppg_error : %d \r\n",aging_t.ppg_error); // if(ft_result.gr_data_final > 5000 || ft_result.red_data_final > 5000 || ft_result.ir_data_final > 5000) // { @@ -304,20 +324,19 @@ void aging_task(void) total_time = 2 * 60; enter_time = 0; age_time = 0; - while(total_time) + uapi_get_timestampe_ss(&enter_time); + do { - uapi_get_timestampe_ss(&enter_time); + uapi_get_timestampe_ss(¤t_time); get_gsonsen_xyz(&g); if(g.x == 0 && g.y == 0 && g.z == 0) { aging_t.gsensor_error++; aging_t.fail_num++; } - uapi_get_timestampe_ss(&age_time); - total_time -= (age_time - enter_time); - PRINT("total_time[%d]\n",total_time); LOS_Msleep(1000); - } + PRINT("current_time - enter_time[%d]\n",current_time - enter_time); + }while(current_time - enter_time <= 2 * 60); PRINT("gsensor失败次数 : %d \r\n",aging_t.gsensor_error); /*********************磁力计 老化测试*****************************/ @@ -326,26 +345,25 @@ void aging_task(void) total_time = 2 * 60; enter_time = 0; age_time = 0; - while(total_time) + uapi_get_timestampe_ss(&enter_time); + do { - uapi_get_timestampe_ss(&enter_time); + uapi_get_timestampe_ss(¤t_time); mmc5603_getdata(&fAzimuth,&fPitch,&fRoll); if(fAzimuth < 0) { aging_t.mag_error++; aging_t.fail_num++; } - uapi_get_timestampe_ss(&age_time); - total_time -= (age_time - enter_time); - PRINT("total_time[%d]\n",total_time); LOS_Msleep(1000); - } + PRINT("current_time - enter_time[%d]\n",current_time - enter_time); + }while(current_time - enter_time <= 2 * 60); PRINT("磁力计失败次数 : %d \r\n",aging_t.mag_error); uapi_get_timestampe_ss(&exit_age_time); aging_time -= (exit_age_time - enter_age_time); - if(aging_time == 0) + if(aging_time <= 0 || aging_time > 2 * 60 * 60) { aging_t.flag = 0xfdfd0000; return; @@ -370,7 +388,7 @@ errcode_t aging_test_init(void) return ERRCODE_FAIL; } - memset(&aging_t, 0, sizeof(ble_aging_t)); + aging_t.flag = 0xfdfd0002; return ERRCODE_SUCC; @@ -854,6 +872,7 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint { //进入老化命令 uint8_t send_data = 0x00; + memset(&aging_t, 0, sizeof(ble_aging_t)); aging_t.target_time = 6 * 60 * 60; //老化时间6小时 aging_time = aging_t.target_time; aging_test_init(); @@ -1872,7 +1891,7 @@ errcode_t factorytest_protocol_decode(uint8_t *buf, uint16_t event_size) printf("crc16 0x%04X vs 0x%04X\n",crc16,crc16_2); - // if( crc16 == crc16_2) //校验通过,开始正式解析 + if( crc16 == crc16_2) //校验通过,开始正式解析 { if(factorytest_mode_flag == 0 && header.submod != BLE_TEST_CMD_COMMON_SUB_MODE_SWITCH_MODE) return ERRCODE_FAIL; diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 5eac7ab4e..93d337894 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -2316,6 +2316,8 @@ errcode_t custom_i2c_read_regs(uint16_t slaveAddr, uint16_t reg, int regLength, data.receive_buf = readData; data.receive_len = readDataSize; + uint32_t irq_sts = osal_irq_lock(); + for (retry = 0; retry < CUSTOM_I2C_TIME_MAX; retry++) { ret = uapi_i2c_master_writeread(busIndex, slaveAddr, &data); if (ret == ERRCODE_SUCC) { @@ -2326,6 +2328,7 @@ errcode_t custom_i2c_read_regs(uint16_t slaveAddr, uint16_t reg, int regLength, PRINT("i2cRead data read fail! busIndex %d, slaveAddr 0x%x, regaddr 0x%X,reglength %d, ret=0x%x\n",busIndex, slaveAddr,reg,regLength, ret); } osal_kfree(write_data); + osal_irq_restore(irq_sts); error: cnt = pm_veto_get_id_cnt(PM_ID_GSENSOR); @@ -2379,6 +2382,9 @@ errcode_t custom_i2c_write_reg(uint16_t slaveAddr, uint16_t reg, int regLength, data.receive_buf = NULL; data.receive_len = 0; + + uint32_t irq_sts = osal_irq_lock(); + for (retry = 0; retry < CUSTOM_I2C_TIME_MAX; retry++) { ret = uapi_i2c_master_write(busIndex, slaveAddr, &data); if (ret == ERRCODE_SUCC) { @@ -2388,6 +2394,8 @@ errcode_t custom_i2c_write_reg(uint16_t slaveAddr, uint16_t reg, int regLength, if (ret != ERRCODE_SUCC) { PRINT("i2cWrite cywee data write fail! ret=0x%x\n", ret); } + + osal_irq_restore(irq_sts); free_mem: osal_kfree(write_data); error: -- 2.17.1