cywee优化acc获取,降低位25Hz,修正acc方向
authorSnickerSun <snickersun@163.com>
Mon, 25 Mar 2024 14:42:52 +0000 (22:42 +0800)
committerSnickerSun <snickersun@163.com>
Mon, 25 Mar 2024 14:42:52 +0000 (22:42 +0800)
code/sdk/drivers/peripheral/cywee/service/cywee_service.c
code/sdk/drivers/peripheral/cywee/src/board_yh601s.c
code/sdk/drivers/peripheral/cywee/src/main_dml.c
code/sdk/drivers/peripheral/cywee/src/test_api.c

index 7720e9f..2f2adf0 100644 (file)
@@ -39,7 +39,7 @@ typedef struct
  * 其他cmd在Header里定义,对外开放
 */
 
-#define CYWEE_CHECK_MS 20
+#define CYWEE_CHECK_MS 40
 
 osTimerId_t g_cywee_service_timer = NULL;
 static bool g_batter_service_initialled = false;
index 495c384..008b25d 100644 (file)
@@ -260,9 +260,11 @@ error:
 //实际精度只能到1ms
 void CWM_OS_uSleep(uint32_t time)
 {
-    uint32_t ms = time / 1000;
-    if (ms == 0)  ms = 1;
-    osDelay(ms);    
+
+    HalDelayUs(time);
+    // uint32_t ms = time / 1000;
+    // if (ms == 0)  ms = 1;
+    // osDelay(ms);    
 }
 
 uint64_t CWM_OS_GetTimeNs(void)
index 3015059..4cad5fe 100644 (file)
@@ -277,7 +277,8 @@ int cywee_main_dml(void) {
     scl.iData[0] = 1;
     scl.iData[3] = 2;
     scl.iData[4] = 2;
-    scl.iData[8] = 52; // for st sensor(52Hz)
+    scl.iData[7] = 5;
+    scl.iData[8] = 25; // for st sensor(52Hz)
     CWM_SettingControl(SCL_DML_DRV_AG_CONFIG, &scl);
     //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__);
 
index cb18e1b..bbaa85a 100644 (file)
@@ -185,11 +185,11 @@ void test_uSleep_3(void) {
     CWM_OS_dbgPrintf("[test_uSleep_3] test 10 seconds start\r\n");
 
     for (j = 0; j < 10; j ++) {
-        // CWM_OS_dbgPrintf("j=%d",j);
+        CWM_OS_dbgPrintf("j=%d\n",j);
         for (i = 0; i < 1000; i ++) {
-            // if (i%10 == 0) CWM_OS_dbgPrintf("i=%d",i);
+            if (i%10 == 0) CWM_OS_dbgPrintf("i=%d\n",i);
             for (k = 0; k < 1000; k ++) {
-                // if (k%100 == 0) CWM_OS_dbgPrintf("k=%d",k);
+                // if (k%100 == 0) CWM_OS_dbgPrintf("k=%d\n",k);
                 CWM_OS_uSleep(1);
             }
         }
@@ -257,7 +257,7 @@ static errcode_t pcm_stream_task_body(void *data)
 
     test_stack();
     test_GetTimeNs_3(); // 20 minutes
-    // test_uSleep_3(); // 10 seconds, accurate to 1us
+    test_uSleep_3(); // 10 seconds, accurate to 1us
 
     return ERRCODE_SUCC;
 }