优化vib震动参数 324/1 324/head 325/target/1
authorSnickerSun <snickersun@163.com>
Wed, 19 Jun 2024 10:22:31 +0000 (18:22 +0800)
committerSnickerSun <snickersun@163.com>
Wed, 19 Jun 2024 10:22:31 +0000 (18:22 +0800)
code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp

index ab5645a..1b3d9ad 100644 (file)
@@ -48,32 +48,6 @@ static bool g_batter_service_initialled = false;
 #include "vibrator_hal.h"
 #include "vibrator.h"
 #include "custom_utils.h"
-void custom_VibratorFunc(OHOS::VibratorType vibratorType)
-{
-
-    vibrator_cmd_t mail = {0};
-    switch (vibratorType)
-    {
-        case OHOS::VibratorType::VIBRATOR_TYPE_ONE:
-            mail.cycle_time_ms=200;
-            mail.duty = 20;
-            mail.duration_time_ms = 100;
-        break;
-        case OHOS::VibratorType::VIBRATOR_TYPE_TWO:
-            mail.cycle_time_ms=200;
-            mail.duty = 20;
-            mail.duration_time_ms = 200;
-        break;
-        case OHOS::VibratorType::VIBRATOR_TYPE_THREE:
-            mail.cycle_time_ms=200;
-            mail.duty = 20;
-            mail.duration_time_ms = 500;
-        break;
-    } 
-
-    do_vibrator_cmd(mail);
-
-}
 
 void custom_VibratorFunc_int(int vibratorType)
 {
@@ -101,6 +75,26 @@ void custom_VibratorFunc_int(int vibratorType)
 
     do_vibrator_cmd(mail);
 }
+
+
+void custom_VibratorFunc(OHOS::VibratorType vibratorType)
+{
+
+    vibrator_cmd_t mail = {0};
+    switch (vibratorType)
+    {
+        case OHOS::VibratorType::VIBRATOR_TYPE_ONE:
+            custom_VibratorFunc_int(1);
+        break;
+        case OHOS::VibratorType::VIBRATOR_TYPE_TWO:
+            custom_VibratorFunc_int(2);
+        break;
+        case OHOS::VibratorType::VIBRATOR_TYPE_THREE:
+            custom_VibratorFunc_int(3);
+        break;
+    } 
+}
+
 #define MAG_CHECK_MS 20
 static unsigned long g_app_queue;