添加电池信息与佩戴信息存储内存管理,优化佩戴检测阈值判断,修复TP失效BUG,更新cywee算法库修复小睡时间异常BUG,优化老化测试 1401/1 1401/head
authorpenglei <1624952103@qq.com>
Thu, 14 Nov 2024 10:53:28 +0000 (18:53 +0800)
committerpenglei <1624952103@qq.com>
Thu, 14 Nov 2024 10:53:28 +0000 (18:53 +0800)
14 files changed:
code/sdk/application/battery/service/battery_driver.cpp
code/sdk/application/battery/service/battery_service.cpp
code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp
code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c
code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv_mac.a
code/sdk/drivers/peripheral/cywee/src/main_dml.c
code/sdk/drivers/peripheral/ppg/hx3695/hx3695_check_touch.c
code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c
code/sdk/drivers/peripheral/touch/touch_screen_drv.c
code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c

index fb24a4f..b5043e7 100644 (file)
@@ -663,6 +663,12 @@ static bool adc_get_voltage_by_channel(float *voltage, uint8_t channel)
 bool batteryservice_get_voltage_by_channel(float *voltage, uint8_t channel)
 {
 
+    uint8_t cnt = pm_veto_get_id_cnt(PM_ID_ADC);
+    if (cnt == 0) 
+    {
+        uapi_pm_add_sleep_veto(PM_ID_ADC);
+    }
+
     uapi_adc_init(ADC_CLOCK_500KHZ);
     uint64_t time1, time2;
     uint32_t param_index = 0;
@@ -670,6 +676,13 @@ bool batteryservice_get_voltage_by_channel(float *voltage, uint8_t channel)
     time1 = uapi_tcxo_get_us();
     if (!adc_get_voltage_by_channel(voltage, channel)) {
         osal_printk("adc get sample result failed.\r\n");
+
+        cnt = pm_veto_get_id_cnt(PM_ID_ADC);
+        if (cnt == 1) 
+        {
+            uapi_pm_remove_sleep_veto(PM_ID_ADC);
+        }
+
         return SUITE_TEST_FAILED;
     }
     time2 = uapi_tcxo_get_us();
@@ -678,6 +691,13 @@ bool batteryservice_get_voltage_by_channel(float *voltage, uint8_t channel)
     // osal_printk("voltage: %.4f.\r\n", voltage);
     // osal_printk("channel %d, voltage: %.4f.\r\n", channel,*voltage);
     uapi_adc_deinit();
+
+    cnt = pm_veto_get_id_cnt(PM_ID_ADC);
+    if (cnt == 1) 
+    {
+        uapi_pm_remove_sleep_veto(PM_ID_ADC);
+    }
+
     return true;
 }
 
index ac35b0e..d749936 100644 (file)
@@ -138,13 +138,19 @@ void battery_get_data(void)
 //保存电池信息到文件
 void battery_save_data(void)
 {
+    len = uapi_get_file_size("/user/userdata/battery_data.bin");
+    if(len > sizeof(BATTERY_DATA_T) * 24 * 7)
+    {
+        uapi_delete_files("/user/userdata/battery_data.bin");
+    }
+
     BATTERY_DATA_T data;
     float voltage;
     uint8_t percent = batteryservice_get_voltage(&voltage);
     data.voltage = voltage;
     data.percent = percent;
     uapi_get_timestampe_ss(&data.tm);
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "data.voltage : %f , data[i].percent : %d  tm : %d",data.voltage,data.percent,data.tm);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "data.voltage : %f , data[i].percent : %d  tm : %d",data.voltage,data.percent,data.tm);
     uapi_save_file_data("user/userdata/battery_data.bin",(uint8_t *)&data,sizeof(BATTERY_DATA_T),"ab");
 }
 
@@ -153,6 +159,10 @@ static void battery_save_percent(void)
 {
     float voltage;
     uint8_t percent = batteryservice_get_voltage(&voltage);
+    if(!percent)
+    {
+        return;
+    }
     uapi_save_file_data("/user/userdata/battery.bin",&percent,1,"wb");
     PRINT("battery_save_percent : %d",percent);
 }
index 2abff27..84e8995 100644 (file)
@@ -538,7 +538,7 @@ extern "C"
                 // if(uapi_dev_runtime_get_nap_monitoring_status() == 1)\r
                     // uapi_clean_sleep_flag();                        // 清除睡眠标志文件\r
                 // OHOS::create_sleep_folder();                     // 创建睡眠文件夹              \r
-                set_keep_in_wear_det_mode(0);                       \r
+                set_keep_in_wear_det_mode(1);                       \r
                 do_cywee_service_check_msg(CYWEE_SERVICE_CMD_GET_SLEEP_DATA, &cmd); // 强制获取小睡数据,结束小睡\r
 \r
                 // 睡眠弹窗\r
index d521e9e..630ee61 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: penglei 1624952103@qq.com
  * @Date: 2024-09-18 17:17:23
  * @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2024-11-05 15:36:33
+ * @LastEditTime: 2024-11-14 11:30:28
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -71,7 +71,7 @@ namespace OHOS
         UILabel *InitLabel(LabelConfig &labelConfig);
         bool testoldScrollViewcrollViewinit(uint8_t);
         UIScrollView *testoldScrollView{nullptr};
-        UILabelButtonExt* labelButton_next = nullptr;
+        UILabelButtonExt* labelButton_exit = nullptr;
         UILabelButtonExt* labelButton_start = nullptr;
         UILabelButtonExt* labelButton_stop = nullptr;
 
index 36a0cdc..c2754d9 100644 (file)
@@ -4,6 +4,7 @@
 #include "producttest/include/testLCD.h"
 #include "producttest/include/testView.h"
 #include "cmsis_os2.h"
+#include "custom_runtime.h"
 #ifdef __cplusplus
 #if __cplusplus
 extern "C"
@@ -157,9 +158,18 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");
             return false;
         }
-        testLCDScrollView->SetOnDragListener(draglistener);
-        testLCDScrollView->SetTouchable(true);
-        testLCDScrollView->SetDraggable(true);
+        if(uapi_dev_runtime_get_factory_test_status_flag())
+        {
+            testLCDScrollView->SetTouchable(false);
+            testLCDScrollView->SetDraggable(false);
+        }
+        else
+        {
+            testLCDScrollView->SetTouchable(true);
+            testLCDScrollView->SetDraggable(true);
+            testLCDScrollView->SetOnDragListener(draglistener);
+        }
+
 
         Title= testAboutView::GetInstance()->init_title(163,45,"LCD_TEST");
         testLCDScrollView->Add(Title);
index fb9bbba..efdc8e2 100644 (file)
@@ -277,6 +277,10 @@ namespace OHOS
         { \r
             factorytest_stop_aging_test();\r
         }\r
+        if(strcmp(view.GetViewId(),"exit") == 0)\r
+        { \r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TEST);\r
+        }\r
         #ifdef SUPPORT_A5133_SERVICE\r
         if(strcmp(view.GetViewId(),"receive") == 0)\r
         { \r
index 7c4517c..6b268ca 100644 (file)
@@ -66,10 +66,10 @@ namespace OHOS
 
 
 
-            if(labelButton_next)
+            if(labelButton_exit)
             {
-                delete labelButton_next;
-                labelButton_next=nullptr;
+                delete labelButton_exit;
+                labelButton_exit=nullptr;
             }
 
             if(labelButton_start)
@@ -530,9 +530,10 @@ namespace OHOS
         }
         testoldScrollView->Add(label_charge_error);
  
-        labelButton_next= testAboutView::GetInstance()->init_button_next(300,300,Test_ViewMapper_t[id].viewid_str_next);
-        labelButton_next->SetText("exit");
-        testoldScrollView->Add(labelButton_next);
+        labelButton_exit= testAboutView::GetInstance()->init_button_next(300,300,Test_ViewMapper_t[id].viewid_str_next);
+        labelButton_exit->SetText("exit");
+        labelButton_exit->SetViewId("exit");
+        testoldScrollView->Add(labelButton_exit);
 
         labelButton_start= testAboutView::GetInstance()->init_button_next(300,100,Test_ViewMapper_t[id].viewid_str_next);
         labelButton_start->SetText("start");
index d250bfb..4f71ef1 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-11-11 17:08:33\r
+ * @LastEditTime: 2024-11-14 16:27:45\r
  * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c\r
  * @Description: \r
  * \r
@@ -481,8 +481,16 @@ void factorytest_protocol_common_decode(uint8_t submode,uint8_t testitem,uint8_t
         case BLE_TEST_CMD_COMMON_SUB_MODE_SWITCH_MODE:\r
             if (testitem == 0x01)\r
             {\r
-    \r
                 uint8_t send_data=0;\r
+                if(factorytest_mode_flag)\r
+                {\r
+                    factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_COMMON,\r
+                    BLE_TEST_CMD_COMMON_SUB_MODE_SWITCH_MODE,\r
+                    0x01,\r
+                    &send_data,\r
+                    1);\r
+                    break;\r
+                }\r
 \r
                 factorytest_mode_flag = 1;\r
 \r
@@ -493,7 +501,7 @@ void factorytest_protocol_common_decode(uint8_t submode,uint8_t testitem,uint8_t
                 factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_COMMON,\r
                 BLE_TEST_CMD_COMMON_SUB_MODE_SWITCH_MODE,\r
                 0x01,\r
-                send_data,\r
+                &send_data,\r
                 1);\r
                 uapi_hfp_connect_();\r
                 LOS_Msleep(500);\r
@@ -508,7 +516,7 @@ void factorytest_protocol_common_decode(uint8_t submode,uint8_t testitem,uint8_t
                 factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_COMMON,\r
                         BLE_TEST_CMD_COMMON_SUB_MODE_SWITCH_MODE,\r
                         0x02,\r
-                        send_data,\r
+                        &send_data,\r
                         1);\r
             }\r
             break;\r
index c520b34..28cd09f 100644 (file)
Binary files a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv_mac.a and b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv_mac.a differ
index c49b719..746bf23 100644 (file)
@@ -1885,6 +1885,11 @@ void cywee_custom_save_nap_data(void)
 
 void cywee_custom_save_wear_data(void)
 {
+    int len = uapi_get_file_size("user/userdata/wear.bin");
+    if(len > sizeof(SLEEP_STAT_T) * 50)
+    {
+        uapi_delete_files("user/userdata/wear.bin");
+    }
     SLEEP_STAT_T data;
     uint32_t tm = 0;
     uapi_get_timestampe_ss(&tm);
index 12eb472..481c0dc 100644 (file)
@@ -179,8 +179,21 @@ hx3695_wear_msg_code_t hx3695_check_touch_send_data(int32_t *ir_data, uint8_t co
 hx3695_wear_msg_code_t check_touch_alg(int32_t ir_data)\r
 {\r
     ir_data = Ir_data;\r
-    //PRINT("ir_data : %d \r\n",ir_data);\r
-    if(ir_data>check_mode_wear_thre)\r
+    PRINT("ir_data : %d \r\n",ir_data);\r
+    if(ir_data > 80000)\r
+    {\r
+        touch_cnt = 0;\r
+        if(notouch_cnt>=2)\r
+        {\r
+            hx3695_wear_status = MSG_NO_WEAR;\r
+            notouch_cnt=0;\r
+        }\r
+        else\r
+        {\r
+            notouch_cnt++;\r
+        }\r
+    }\r
+    else if(ir_data>check_mode_wear_thre && ir_data < 80000)\r
     {\r
         notouch_cnt = 0;\r
         if(touch_cnt>=2)\r
index 0e4ed0e..1adbe48 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: penglei 1624952103@qq.com
  * @Date: 2024-03-13 15:08:38
  * @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2024-11-12 18:05:23
+ * @LastEditTime: 2024-11-14 17:09:10
  * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c
  * @Description: 
  * 
@@ -76,11 +76,11 @@ void ppg_send_cmd_to_driver(char* mode, uint8_t enable)
         {
 #ifdef HRS_ALG_LIB   
             hx3695_hrs_disable();
-            if(uapi_dev_runtime_get_sleep_monitoring_status() && uapi_dev_runtime_get_hrs_passivity_flag())//处于睡眠监测 且在心率周期检测期间 上报活体佩戴 
-            {
-                hx3695_wearstatus_update();   
-                uapi_dev_runtime_set_hrs_passivity(0);//清除被动检测runtime     
-            }
+            // if(uapi_dev_runtime_get_sleep_monitoring_status() && uapi_dev_runtime_get_hrs_passivity_flag())//处于睡眠监测 且在心率周期检测期间 上报活体佩戴 
+            // {
+            //     hx3695_wearstatus_update();   
+            //     uapi_dev_runtime_set_hrs_passivity(0);//清除被动检测runtime     
+            // }
 #endif
         }else  if(md == HRV_MODE)
         {
index 0a27a24..e45b30e 100644 (file)
@@ -448,6 +448,7 @@ void touch_screen_suspend(void)
 
 void touch_screen_resume(void)
 {
+    uint32_t irq_sts = osal_irq_lock();
     uapi_gpio_disable_interrupt(TOUCH_INT_GPIO); // close tp_int gpio interrupt
     i2c_recovery_reg(TOUCH_I2C_BUS);
 #if defined(TPTYPE_TMA525B)
@@ -463,6 +464,7 @@ void touch_screen_resume(void)
     ztw523_resume();
 #endif
     uapi_gpio_enable_interrupt(TOUCH_INT_GPIO); // open tp_int gpio interrupt
+    osal_irq_restore(irq_sts);
 }
 
 void touch_suspend_for_i2c(void)
index 9504e1e..3d15dd3 100755 (executable)
@@ -189,7 +189,7 @@ static int32_t AIDevOpen(td_handle *aiHandle, enum AudioCategory audioCategory)
         MEDIA_HAL_DOFUNC_TIME(ret = uapi_ai_get_volume(*aiHandle, &gain));
         CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "uapi_ai_get_volume failed");
 
-        gain.integer = gain.integer - 6; // 前端mic灵敏度不同可通过此处调增,增加4db增益  默认gain.integer = gain.integer+4
+        gain.integer = gain.integer - 9; // 前端mic灵敏度不同可通过此处调增,增加4db增益  默认gain.integer = gain.integer+4
         MEDIA_HAL_DOFUNC_TIME(ret = uapi_ai_set_volume(*aiHandle, &gain));
         CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "uapi_ai_set_volume failed");
         g_subPortTrackInOpened = true;