修复gsensor性别设置错误的bug,修复重复开启gsensor的bug
authorpenglei <1624952103@qq.com>
Thu, 17 Oct 2024 03:26:35 +0000 (11:26 +0800)
committerpenglei <1624952103@qq.com>
Thu, 17 Oct 2024 03:26:35 +0000 (11:26 +0800)
code/sdk/drivers/peripheral/cywee/src/main_dml.c
code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c

index 7146f7b..6eedcd4 100644 (file)
@@ -68,11 +68,11 @@ static int sedentary_interval = 1;
 
 static int sedentary_interval_count = 0;
 
-#ifdef FD230
-static int cywee_switch = 1;
-#else
-static int cywee_switch = 0;
-#endif
+// #ifdef FD230
+// static int cywee_switch = 1;
+// #else
+// static int cywee_switch = 0;
+// #endif
 static uint8_t cywee_is_active = 0;
 
 static uint8_t is_static_state = 0;
@@ -157,7 +157,12 @@ uint8_t cywee_get_active_state(void)
 
 void cywee_stop(void)
 {
-    cywee_switch = 0;
+    // cywee_switch = 0;
+    memset(&scl, 0, sizeof(scl));
+    scl.iData[0] = 1;
+    scl.iData[1] = 1;
+    scl.iData[2] = 0;
+    CWM_SettingControl(SCL_DML_DRV_ENABLE, &scl);
 }
 
 void cywee_get_acc_switch(int cmd)
@@ -432,7 +437,7 @@ void cywee_set_user_info(void)
     memset(&scl, 0, sizeof(scl));
     scl.iData[0] = 1;
     scl.iData[1] = user_info[0];
-    scl.iData[2] = user_info[1];
+    scl.iData[2] = !user_info[1]; //APP 1女 0男
     scl.iData[3] = user_info[2];
     scl.iData[4] = user_info[3];
     scl.iData[5] = user_info[4];
@@ -1310,6 +1315,7 @@ int cywee_main_dml(void)
     memset(&scl, 0, sizeof(scl));
     scl.iData[0] = 1;
 #ifdef AP_ENABLE_DML_SDO_LISTEN
+    // scl.iData[1] = 4+16;
        scl.iData[2] = 2+16;    //分离式DML
     CWM_CustomSensorInput_Fifo_Init(25);
 #else
@@ -1480,7 +1486,7 @@ int cwm_lib_process(void)   //运行算法
 
 void cywee_int_handler(void)
 {
-    if(cywee_switch == 1)
+    // if(cywee_switch == 1)
     {
 #ifdef AP_ENABLE_DML_SDO_LISTEN
         cwm_lib_process();
index f6ffc42..152079c 100644 (file)
@@ -2755,6 +2755,7 @@ hrs_sensor_data_t   hrs_s_dat;
 \r
 static uint8_t his_wear = 2;\r
 static uint8_t wear_cnt = 0;\r
+static uint8_t acc_restart_flag = 0;\r
 \r
 void hx3695_hrs_ppg_Int_handle(void)\r
 {\r
@@ -2838,14 +2839,16 @@ void hx3695_hrs_ppg_Int_handle(void)
       if(gsensordata[ii].x == 0.0f && gsensordata[ii].y == 0.0f && gsensordata[ii].z == 0.0f)\r
       {\r
           timeout++;\r
-          if(timeout > 20)\r
+          if(timeout > 20 && !acc_restart_flag) //避免重复开关gsensor\r
           {\r
               do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESTART_ACC,NULL);\r
+              acc_restart_flag = 1;\r
           }\r
       }\r
       else\r
       {\r
           timeout = 0;\r
+          acc_restart_flag = 0;\r
       }\r
       if(ii == 8)\r
       {\r