优化表冠震动,回退睡眠修改 3084/1 3084/head 3097/target/1
authorpenglei <1624952103@qq.com>
Wed, 14 Jan 2026 02:15:25 +0000 (10:15 +0800)
committerpenglei <1624952103@qq.com>
Wed, 14 Jan 2026 02:15:25 +0000 (10:15 +0800)
code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c
code/sdk/zhihui/drivers/rotary_encoder/rotary_encoder_def.h
code/sdk/zhihui/drivers/rotary_encoder/rotary_encoder_drv.c
code/sdk/zhihui/drivers/rotary_encoder/rotary_encoder_drv.h
code/sdk/zhihui/drivers/vibrator/service/vibrator_service.cpp

index 7bc7cc4..adc8a6f 100644 (file)
@@ -1149,19 +1149,19 @@ void cywee_wearstatus_update(int wearstatus)
                 cywee_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY_AND_NAP);
             }
         }
-        else if(uapi_dev_runtime_get_sleep_monitoring_status())
-        {
-            if(uapi_dev_runtime_get_sleep_status())
-            {
-                uapi_dev_runtime_set_absolute_static_status(1);
-                cywee_get_sleep_data(1);
-            }
-            else
-            {
-                cywee_inactivity_mode_change(INACTIVITY_MODE_NOTHING);
-                cywee_inactivity_mode_change(INACTIVITY_MODE_SLEEPING);
-            }
-        }
+        // else if(uapi_dev_runtime_get_sleep_monitoring_status())
+        // {
+        //     if(uapi_dev_runtime_get_sleep_status())
+        //     {
+        //         uapi_dev_runtime_set_absolute_static_status(1);
+        //         cywee_get_sleep_data(1);
+        //     }
+        //     else
+        //     {
+        //         cywee_inactivity_mode_change(INACTIVITY_MODE_NOTHING);
+        //         cywee_inactivity_mode_change(INACTIVITY_MODE_SLEEPING);
+        //     }
+        // }
 
         wearstatus = 0;
     }
index 773755e..dbe1e9e 100644 (file)
@@ -48,12 +48,12 @@ extern "C" {
 
 #define re_err(x, ...) \
     do { \
-        PRINT("[ERROR]%s(%d): "x"\r\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+        PRINT("[ERROR]%s(%d): " x "\r\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); \
     } while (0)
 
 #define re_warning(x, ...) \
     do { \
-        PRINT("[WARNING]%s(%d): "x"\r\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+        PRINT("[WARNING]%s(%d): " x "\r\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); \
     } while (0)
 
 
index 61e6d85..eb2140b 100644 (file)
@@ -526,4 +526,17 @@ void rotary_get_chip_id(uint16_t *id)
 #elif defined ROTARYENCODER_HX3508
         hx3508_get_chip_id(id);
 #endif
+}
+
+uint8_t rotary_get_stand_still(void)
+{
+    uint8_t stand_still = 1;
+#ifdef ROTARYENCODER_HX3507
+    stand_still = hx3507_get_stand_still();
+#elif defined ROTARYENCODER_MIXO
+    stand_still = mixo_get_stand_still();
+#elif defined ROTARYENCODER_HX3508
+    stand_still = hx3508_get_stand_still();
+#endif
+    return stand_still;
 }
\ No newline at end of file
index ef038ee..e082e5a 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: penglei 1624952103@qq.com
  * @Date: 2025-07-29 10:06:52
  * @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2025-11-12 12:29:12
+ * @LastEditTime: 2026-01-13 18:02:35
  * @FilePath: /FD230/code/sdk/zhihui/drivers/rotary_encoder/rotary_encoder_drv.h
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -48,5 +48,6 @@ ext_errno rotary_encoder_module_init(void);
 ext_errno rotary_encoder_module_deinit(void);
 ext_errno encoder_info_process(void);
 void rotary_get_chip_id(uint16_t *id);
+uint8_t rotary_get_stand_still(void);
 
 #endif
\ No newline at end of file
index 7b06bf4..a1c7c9e 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: penglei 1624952103@qq.com
  * @Date: 2024-08-08 16:33:23
  * @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2025-11-28 12:07:56
+ * @LastEditTime: 2026-01-13 18:02:48
  * @FilePath: /FD230/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp
  * @Description: 
  * 
@@ -41,6 +41,9 @@ extern "C" {
 #include "custom_save_runtime.h"
 #include "input_app.h"
 
+#include "rotary_encoder_drv.h"
+
+
 void custom_VibratorFunc_int(int vibratorType)
 {
     uapi_save_runtime_log(RUNTIME_LOG_MOTOR_START);
@@ -88,6 +91,53 @@ void custom_VibratorFunc_int(int vibratorType)
 }
 
 
+static void custom_VibratorFunc_for_encoder(int vibratorType)
+{
+    uapi_save_runtime_log(RUNTIME_LOG_MOTOR_START);
+    
+    //忽略系统调用参数,只按照configmodel里保存的值来震动
+    uint8_t vibmod = uapi_dev_runtime_get_vibmod();
+    
+    vibrator_cmd_t mail = {1};
+    if(vibratorType == 4)
+        vibmod = 4;
+    else if(vibratorType == 5)
+        vibmod = 5;
+    switch (vibmod)
+    {
+    case 5:
+        mail.cycle_time_ms = 235;
+        mail.duty = 65;
+        mail.duration_time_ms = 100;
+        break;  
+    case 4:
+        mail.cycle_time_ms = 235;
+        mail.duty = 65;
+        mail.duration_time_ms = 2000;
+        break;
+    case 3:
+        mail.cycle_time_ms = 235;
+        mail.duty = 50;
+        mail.duration_time_ms = 60;
+        break;
+    case 2:
+        mail.cycle_time_ms = 235;
+        mail.duty = 50;
+        mail.duration_time_ms = 40;
+        break;
+    case 1:
+        mail.cycle_time_ms = 235;
+        mail.duty = 50;
+        mail.duration_time_ms = 20;
+        break;
+    default:
+        break;
+    }
+    // PRINT("cycle_time_ms[%d], duty[%d], duration_time_ms[%d] \n",mail.cycle_time_ms,mail.duty,mail.duration_time_ms);
+    do_vibrator_cmd(mail);
+}
+
+
 void custom_VibratorFunc(OHOS::VibratorType vibratorType)
 {
 
@@ -95,13 +145,13 @@ void custom_VibratorFunc(OHOS::VibratorType vibratorType)
     switch (vibratorType)
     {
         case OHOS::VibratorType::VIBRATOR_TYPE_ONE:
-            custom_VibratorFunc_int(1);
+            custom_VibratorFunc_for_encoder(1);
         break;
         case OHOS::VibratorType::VIBRATOR_TYPE_TWO:
-            custom_VibratorFunc_int(2);
+            custom_VibratorFunc_for_encoder(2);
         break;
         case OHOS::VibratorType::VIBRATOR_TYPE_THREE:
-            custom_VibratorFunc_int(3);
+            custom_VibratorFunc_for_encoder(3);
         break;
     } 
 }
@@ -155,7 +205,18 @@ static void vibrator_service_check_task(void  *arg)
             case 0:
                 g_VibratorFunc( mail.duty ,  mail.cycle_time_ms, mail.duration_time_ms);
                 break;
+
             case 1:
+
+                if(rotary_get_stand_still())
+                {
+                    break;
+                }
+
+                g_VibratorFunc( mail.duty ,  mail.cycle_time_ms, mail.duration_time_ms);
+                break;
+
+            case 2:
                 // touch_screen_resume();
                 break;
         }