优化凌晨清除运动数据 调整部分产测指令 优化绝对静止判断处理
authorpenglei <1624952103@qq.com>
Sat, 26 Oct 2024 06:51:38 +0000 (14:51 +0800)
committeraliyun:aliyun0384013184_1JeGs <3449750381@qq.com>
Sat, 26 Oct 2024 08:12:31 +0000 (08:12 +0000)
code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h
code/sdk/drivers/peripheral/cywee/src/main_dml.c

index 93146e1..7470baa 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: penglei 1624952103@qq.com\r
  * @Date: 2024-06-17 14:31:08\r
  * @LastEditors: penglei 1624952103@qq.com\r
- * @LastEditTime: 2024-10-23 19:40:27\r
+ * @LastEditTime: 2024-10-26 14:25:38\r
  * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c\r
  * @Description: \r
  * \r
@@ -164,14 +164,6 @@ void ble_acc_check_timer_callback(void)
             6);\r
 }\r
 \r
-\r
-    uint32_t executions_num;//执行次数 \r
-    uint32_t fail_num;      //失败次数\r
-    uint32_t target_hour;    //目标时间\r
-    uint32_t enter_age_time;  //进入老化时间\r
-    uint32_t age_time;      //每轮老化结束时间\r
-\r
-\r
 void aging_task(void)\r
 {\r
     errcode_t ret = 0;\r
@@ -460,10 +452,21 @@ void factorytest_protocol_common_decode(uint8_t submode,uint8_t testitem,uint8_t
                 uint16_t tp_id;\r
                 uint32_t chip_id;\r
                 //系统自检\r
+\r
+                bool state;\r
+                state = uapi_get_charger_plug_status();\r
+                if (!state) \r
+                    send_data[1] |= state << 0;\r
+                \r
                 uapi_cywee_get_id(&id);\r
                 if(id != 0x44)\r
                     send_data[1] |= 1 << 1;\r
 \r
+                unsigned char mmc_id;\r
+                mmc5603_getid(&mmc_id);\r
+                if(mmc_id != 0x10)\r
+                    send_data[1] |= 2 << 4;\r
+\r
                 touch_getid(&tp_id);\r
                 PRINT("touch_getid : %2X \r\n",tp_id);\r
                 if(tp_id != 0x6456)\r
@@ -642,17 +645,6 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint
                         &send_data,\r
                         1);\r
             }\r
-            if (testitem == 0x06)\r
-            {\r
-                uint8_t send_data = 0x00;\r
-                uapi_hfp_connect_();\r
-                factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
-                        BLE_TEST_CMD_SOFT_TEST_SUB_MODE_BLE,\r
-                        0x06,\r
-                        &send_data,\r
-                        1);\r
-            }\r
-\r
             break;\r
 \r
         case BLE_TEST_CMD_SOFT_TEST_SUB_MODE_VIBRATOR:\r
@@ -1796,6 +1788,17 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint
                         &send_data,\r
                         1);\r
             } \r
+            if (testitem == 0x03)\r
+            {\r
+                uint8_t send_data = 0x00;\r
+                uapi_hfp_connect_();\r
+                factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
+                        BLE_TEST_CMD_SOFT_TEST_SUB_MODE_SPEAKER,\r
+                        0x03,\r
+                        &send_data,\r
+                        1);\r
+            }\r
+\r
             //else if(testitem == 0x03)\r
             // {\r
             //     //播放录音\r
index bb60c5b..1f17726 100644 (file)
@@ -602,6 +602,7 @@ void MsgCenterNotifyNextDayProc(const Topic topic, Request *req)
     {
         set_Is_shouw_falg(1,i);
     }
+    cywee_reset_history_daily_data(); //清除运动相关数据
     do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL);
     /* ---------------------------------- 呼吸训练相关 ---------------------------------- */
     RespiratoryTrainingModel::GetInstance().ClearTotalRespiratoryTrainingTime();
index 447c66d..94baddf 100644 (file)
@@ -577,8 +577,7 @@ void cywee_save_sleep_stat_data(void);
 
 void cywee_custom_save_sleep_data(void);
 void cywee_custom_save_nap_data(void);
-
-extern uint8_t hrs_mode_state;
+void cywee_reset_history_daily_data(void);
 
 #pragma pack()
 
index c56f8f4..3bb51a2 100644 (file)
@@ -671,10 +671,12 @@ void cywee_hand_updown_switch(int cmd)
         CWM_Sensor_Disable(IDX_ALGO_WATCH_HANDUP);
 }
 
-void cywee_reset_daily_data(void)
+void cywee_reset_history_daily_data(void)
 {
-    memset(&scl, 0, sizeof(scl));
-    CWM_SettingControl(SCL_RESET_DAILY_INFO, &scl);
+    stepcount=0;
+    new_distance=0;
+    new_fat=0;
+    new_calories=0;
     history_step = 0;
     history_calories=0; //卡路里数据
     history_distances=0; //历史数据
@@ -682,6 +684,17 @@ void cywee_reset_daily_data(void)
     new_fat = 0; //当前燃脂数据
 }
 
+void cywee_reset_daily_data(void)
+{
+    memset(&scl, 0, sizeof(scl));
+    CWM_SettingControl(SCL_RESET_DAILY_INFO, &scl);
+    // history_step = 0;
+    // history_calories=0; //卡路里数据
+    // history_distances=0; //历史数据
+    // history_fat=0; //历史燃脂数据
+    // new_fat = 0; //当前燃脂数据
+}
+
 //INT[1] : 0 立即输出,但不中止睡眠。 1 立即输出且中止睡眠
 void cywee_get_sleep_data(int cmd)
 {
@@ -1132,6 +1145,15 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) {
             CWM_OS_dbgPrintf("IDX_ALGO_SHAKE\n");
              break;
         case IDX_ALGO_INACTIVITY_OUTPUT:
+            if(uapi_dev_runtime_get_absolute_static_status()) //绝对静止 直接退出
+            {
+                if((int)sensorEVT->fData[0] == 31 || (int)sensorEVT->fData[0] == 32) //最后一笔数据上报时 清除相应标志位
+                {
+                    uapi_dev_runtime_set_absolute_static_status(0);
+                }
+                break;
+            }
+
             cywee_func = cywee_get_send_msg_callback_func();
             CWM_OS_dbgPrintf("IDX_ALGO_INACTIVITY_OUTPUT\n");
             if((int)sensorEVT->fData[0] == 20)
@@ -1206,17 +1228,6 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) {
                 // cywee_func(CYWEE_MSG_TYPE_INACTIVITY_UPDATE,&c_inactivity_result_t,sizeof(cywee_inactivity_result_t));
 
             }else if((int)sensorEVT->fData[0] == 31){
-                
-                if(uapi_dev_runtime_get_absolute_static_status())
-                {
-                    uapi_dev_runtime_set_absolute_static_status(0);//清除绝对静止状态
-                    stat_num = 0;
-                    memset(&sleep_stat,0,SLEEP_STATUS_LENGTH * sizeof(SLEEP_STAT_T));
-                    fall_asleep_timestamp = 0;
-                    break ; //绝对静止状态不存数据
-                }
-
-
                 memset(&c_inactivity_accumulate_time_t,0,sizeof(cywee_inactivity_accumulate_time_t));
                 
                 c_inactivity_accumulate_time_t.output_number = (int)sensorEVT->fData[0];
@@ -1696,6 +1707,14 @@ int cywee_main_dml(void)
         CWM_OS_dbgPrintf("DML device[%d]: hw_id=%d hw_attr=%d\n", i, scl.iData[6 + i * 2], scl.iData[7 + i * 2]);
     }
 
+#if 0
+    memset(&scl, 0, sizeof(scl));
+    scl.iData[0] = 1;
+    scl.iData[3] = 9;
+    scl.iData[4] = 5;
+    scl.iData[7] = -1;
+    CWM_SettingControl(SCL_LOG, &scl); 
+#endif
     //设置抬腕功能
     memset(&scl, 0, sizeof(scl));
     scl.iData[0] = 1;