From: penglei <1624952103@qq.com> Date: Thu, 14 Nov 2024 10:53:28 +0000 (+0800) Subject: 添加电池信息与佩戴信息存储内存管理,优化佩戴检测阈值判断,修复TP失效BUG,更新cywee算法库修复小睡时间异常BUG,优化老化测试 X-Git-Tag: fd230_release_V1.3.102~78^2~3 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1401%2F1;p=mirrors%2FFD230.git 添加电池信息与佩戴信息存储内存管理,优化佩戴检测阈值判断,修复TP失效BUG,更新cywee算法库修复小睡时间异常BUG,优化老化测试 --- diff --git a/code/sdk/application/battery/service/battery_driver.cpp b/code/sdk/application/battery/service/battery_driver.cpp index fb24a4f89..b5043e76d 100644 --- a/code/sdk/application/battery/service/battery_driver.cpp +++ b/code/sdk/application/battery/service/battery_driver.cpp @@ -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; } diff --git a/code/sdk/application/battery/service/battery_service.cpp b/code/sdk/application/battery/service/battery_service.cpp index ac35b0ed3..d7499366f 100644 --- a/code/sdk/application/battery/service/battery_service.cpp +++ b/code/sdk/application/battery/service/battery_service.cpp @@ -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); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp index 2abff278c..84e899579 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -538,7 +538,7 @@ extern "C" // if(uapi_dev_runtime_get_nap_monitoring_status() == 1) // uapi_clean_sleep_flag(); // 清除睡眠标志文件 // OHOS::create_sleep_folder(); // 创建睡眠文件夹 - set_keep_in_wear_det_mode(0); + set_keep_in_wear_det_mode(1); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_GET_SLEEP_DATA, &cmd); // 强制获取小睡数据,结束小睡 // 睡眠弹窗 diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h index d521e9ecb..630ee6104 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h @@ -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; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp index 36a0cdc89..c2754d9a1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp @@ -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); diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp index fb9bbba4c..efdc8e26c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp @@ -277,6 +277,10 @@ namespace OHOS { factorytest_stop_aging_test(); } + if(strcmp(view.GetViewId(),"exit") == 0) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_TEST); + } #ifdef SUPPORT_A5133_SERVICE if(strcmp(view.GetViewId(),"receive") == 0) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp index 7c4517c58..6b268cab9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp @@ -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"); diff --git a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c index d250bfb2f..4f71ef184 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-06-17 14:31:08 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-11-11 17:08:33 + * @LastEditTime: 2024-11-14 16:27:45 * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c * @Description: * @@ -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: if (testitem == 0x01) { - uint8_t send_data=0; + if(factorytest_mode_flag) + { + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_COMMON, + BLE_TEST_CMD_COMMON_SUB_MODE_SWITCH_MODE, + 0x01, + &send_data, + 1); + break; + } factorytest_mode_flag = 1; @@ -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, BLE_TEST_CMD_COMMON_SUB_MODE_SWITCH_MODE, 0x01, - send_data, + &send_data, 1); uapi_hfp_connect_(); LOS_Msleep(500); @@ -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, BLE_TEST_CMD_COMMON_SUB_MODE_SWITCH_MODE, 0x02, - send_data, + &send_data, 1); } break; diff --git a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv_mac.a b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv_mac.a index c520b342d..28cd09f4b 100644 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 diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index c49b71924..746bf2325 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -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); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_check_touch.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_check_touch.c index 12eb47233..481c0dc51 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_check_touch.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_check_touch.c @@ -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) { ir_data = Ir_data; - //PRINT("ir_data : %d \r\n",ir_data); - if(ir_data>check_mode_wear_thre) + PRINT("ir_data : %d \r\n",ir_data); + if(ir_data > 80000) + { + touch_cnt = 0; + if(notouch_cnt>=2) + { + hx3695_wear_status = MSG_NO_WEAR; + notouch_cnt=0; + } + else + { + notouch_cnt++; + } + } + else if(ir_data>check_mode_wear_thre && ir_data < 80000) { notouch_cnt = 0; if(touch_cnt>=2) diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c index 0e4ed0e77..1adbe4893 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c @@ -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) { diff --git a/code/sdk/drivers/peripheral/touch/touch_screen_drv.c b/code/sdk/drivers/peripheral/touch/touch_screen_drv.c index 0a27a2400..e45b30ed7 100644 --- a/code/sdk/drivers/peripheral/touch/touch_screen_drv.c +++ b/code/sdk/drivers/peripheral/touch/touch_screen_drv.c @@ -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) diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c index 9504e1e59..3d15dd36a 100755 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c @@ -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;