* @Author: penglei 1624952103@qq.com\r
* @Date: 2024-06-17 14:31:08\r
* @LastEditors: penglei 1624952103@qq.com\r
- * @LastEditTime: 2024-10-31 21:19:20\r
+ * @LastEditTime: 2024-11-01 11:35:05\r
* @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c\r
* @Description: \r
* \r
\r
typedef struct\r
{\r
- uint32_t flag; //老化测试状态 (未开始 - 0, 已开始 - 1, 停止 - 2,完成 - 3)\r
- uint32_t target_time; //目标时间\r
- uint32_t left_time; //剩余时间\r
- uint32_t executions_num;//执行次数 \r
- uint32_t fail_num; //总失败次数\r
- uint32_t display_error; //LCD失败次数\r
- uint32_t tp_error; //tp失败次数\r
- uint32_t crown_error; //表冠失败次数\r
- uint32_t gsensor_error; //gsensor失败次数\r
- uint32_t ppg_error; //ppg失败次数\r
- uint32_t mag_error; //磁力计失败次数 \r
- uint32_t motor_error; //马达失败次数 \r
- uint32_t mic_error; //mic失败次数 \r
- uint32_t speaker_error; //spk失败次数 \r
uint32_t charge_error; //充电失败次数 \r
-}ble_aging_t;\r
+ uint32_t speaker_error; //spk失败次数 \r
+ uint32_t mic_error; //mic失败次数 \r
+ uint32_t motor_error; //马达失败次数 \r
+ uint32_t mag_error; //磁力计失败次数 \r
+ uint32_t ppg_error; //ppg失败次数\r
+ uint32_t gsensor_error; //gsensor失败次数\r
+ uint32_t crown_error; //表冠失败次数\r
+ uint32_t tp_error; //tp失败次数\r
+ uint32_t display_error; //LCD失败次数\r
+ uint32_t fail_num; //总失败次数\r
+ uint32_t executions_num;//执行次数 \r
+ uint32_t left_time; //剩余时间\r
+ uint32_t target_time; //目标时间\r
+ uint32_t flag; //老化测试状态 (未开始 - 0, 已开始 - 1, 停止 - 2,完成 - 3)\r
+} ble_aging_t;\r
\r
#pragma pack()\r
\r
cmd = 1; \r
LOS_Msleep(1000);\r
}\r
- \r
+ cmd = 5;\r
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_COLOR_TEST,&cmd,sizeof(cmd));\r
/*********************TP 老化测试*****************************/\r
//读TP ID\r
uint16_t tp_id;\r
PRINT("磁力计失败次数 : %d \r\n",aging_t.mag_error);\r
\r
uapi_get_timestampe_ss(¤t_aging_time);\r
- aging_time = aging_t.target_time - (current_aging_time - enter_aging_time);\r
- PRINT("aging_time : %d \r\n",aging_time);\r
if(current_aging_time - enter_aging_time > aging_t.target_time)\r
{\r
aging_t.flag = 3;\r
+ aging_time = 0;\r
+ aging_t.left_time = 0;\r
+ PRINT("老化完成\n");\r
return;\r
}\r
+ aging_time = aging_t.target_time - (current_aging_time - enter_aging_time);\r
+ PRINT("aging_time : %d \r\n",aging_time);\r
+\r
}\r
}\r
\r
//查询老化标志\r
uint8_t send_data[3] = {0};\r
\r
+ send_data[1] = aging_t.flag;\r
+\r
if(aging_t.fail_num != 0)\r
{\r
- send_data[1] = 0xff;\r
send_data[2] = 0x01;\r
}\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
} else if(testitem == 0x04)\r
{\r
//查询老化结果\r
- \r
- uint8_t *databuf = malloc(sizeof(ble_aging_t));\r
- uint8_t *ptr = (uint8_t *)&aging_t;\r
- for(int i = 0; i < sizeof(ble_aging_t); i++) \r
+ int size = sizeof(ble_aging_t);\r
+ uint8_t *databuf = (uint8_t *)malloc(size);\r
+ if (databuf == NULL) \r
{\r
- *databuf++ = ptr[i];\r
+ PRINT("malloc failed \n");\r
+ return ;\r
}\r
\r
+ uint8_t *buf = databuf;\r
+ const uint8_t *structBytes = (const uint8_t *)&aging_t;\r
+\r
+ for (int i = 0; i < size; i++) \r
+ buf[size - 1 - i] = structBytes[i];\r
+\r
\r
factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
BLE_TEST_CMD_SOFT_TEST_SUB_MODE_AGING_TEST,\r
0x04,\r
databuf,\r
- sizeof(ble_aging_t));\r
+ size);\r
+ \r
free(databuf);\r
} else if(testitem == 0x05)\r
{\r