From: penglei <1624952103@qq.com> Date: Tue, 29 Oct 2024 09:59:57 +0000 (+0800) Subject: 优化gsensor超时重启机制 X-Git-Tag: fd230_release_V1.3.102~29^2~107 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=8d714e39fc87c5921b8af0a6c5cfee21e130011f;p=mirrors%2FFD230.git 优化gsensor超时重启机制 优化抬腕亮屏灵敏度 调整佩戴检测红外值 通话使用receiver参数 --- diff --git a/code/sdk/application/audio/vendor/aw88166/aw88166.c b/code/sdk/application/audio/vendor/aw88166/aw88166.c index 8a01b7118..70b48af45 100755 --- a/code/sdk/application/audio/vendor/aw88166/aw88166.c +++ b/code/sdk/application/audio/vendor/aw88166/aw88166.c @@ -263,8 +263,8 @@ td_s32 audio_aw88166_set_aef_profile(uapi_snd_aef_profile aef_profile) /* awinic:set mode "Receiver"/"Music", "aw_params.h" contains id information */ if (aef_profile == UAPI_SND_AEF_PROFILE_VOIP) { /* awinic:set mode "Receiver" */ - // ret = aw883xx_set_profile_byname(AW_DEV_0, "Receiver"); - ret = aw883xx_set_profile_byname(AW_DEV_0, "Music"); //所有通路用同一套参数。解决打电话音量小的问题。 + ret = aw883xx_set_profile_byname(AW_DEV_0, "Receiver"); + // ret = aw883xx_set_profile_byname(AW_DEV_0, "Music"); //所有通路用同一套参数。解决打电话音量小的问题。 } else { /* awinic:set mode "Music" */ ret = aw883xx_set_profile_byname(AW_DEV_0, "Music"); 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 586048e5c..74607afc2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -358,6 +358,7 @@ extern "C" if (curTime.tm_sec % 3 == 0) { do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_BLE_ADV_CHECK, nullptr, 0); + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CHECK_ACC,NULL); //检查gsensor是否停止 } if (g_alarmCtrA.state == ALARM_STATUS_RUNNING) diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index 94baddf18..38c05a0ae 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -578,7 +578,7 @@ void cywee_save_sleep_stat_data(void); void cywee_custom_save_sleep_data(void); void cywee_custom_save_nap_data(void); void cywee_reset_history_daily_data(void); - +void cywee_check_acc(void); #pragma pack() diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h index e686ec3de..4f7841902 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-26 20:29:58 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-08-16 15:46:30 + * @LastEditTime: 2024-10-28 20:02:18 * @FilePath: /FD230/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h * @Description: * @@ -95,6 +95,8 @@ extern "C" { #define CYWEE_SERVICE_CMD_RESTART_ACC 0x35 +#define CYWEE_SERVICE_CMD_CHECK_ACC 0x36 + errcode_t uapi_cywee_service_init(void); void uapi_cywee_service_deinit(void); diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index 0416eef6c..d506a65eb 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -409,6 +409,10 @@ static void cywee_service_check_task(void const *arg) case CYWEE_SERVICE_CMD_RESTART_ACC: cywee_restart_acc(); break; + + case CYWEE_SERVICE_CMD_CHECK_ACC: + cywee_check_acc(); + break; default: PRINT("unkonw cmd \r\n"); break; diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 3bb51a27d..7093d5f12 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -120,6 +120,8 @@ static uint8_t ephemeral_flag = 0; //临时数据 static uint8_t wear_status = 0;//佩戴状态 +static uint8_t timeout = 0; + #ifdef CYWEE_MAC_ACTIVE int cm__hs1__mac_c1_init(void); int cm__hs1__deinit(void); @@ -129,6 +131,17 @@ int cm__hs1__init(void); int cm__hs1__deinit(void); #endif +void cywee_check_acc(void) +{ + if(!timeout) + { + cywee_restart_acc(); + } + else + { + timeout = 0; + } +} void clean_sleep_data(void) { @@ -354,6 +367,9 @@ void cywee_set_sleep_stat_data(cywee_inactivity_result_t c_inactivity_result_t) } else if(sleep_stat[stat_num].stat == 4) { + //目前cywee出睡时间戳有bug 暂时先用系统时间戳 + uapi_get_timestampe_ss(×tamp); + sleep_stat[stat_num].timestamp = timestamp; wake_up_timestamp = sleep_stat[stat_num].timestamp; sleep_update_timestamp = wake_up_timestamp; } @@ -394,6 +410,9 @@ void cywee_log_switch(int cmd) void cywee_restart_acc(void) { + uint32_t tm = 0; + uapi_get_timestampe_ss(&tm); + CWM_OS_dbgPrintf("cywee_restart_acc : %d \n",tm); memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; scl.iData[1] = 1; @@ -1015,7 +1034,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { cywee_inactivity_result_t c_inactivity_result_t; cywee_inactivity_accumulate_time_t c_inactivity_accumulate_time_t; cywee_activity_result_extre_info_t c_activity_result_extre_info_t; - + uint32_t tm = 0; switch (sensorEVT->sensorType) { case IDX_ACCEL: gxyz_t.x = sensorEVT->fData[0]; @@ -1319,7 +1338,8 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { }else if((int)sensorEVT->fData[0] == 102) { - CWM_OS_dbgPrintf("ar alert type : %d\n",(int)sensorEVT->fData[1]); + uapi_get_timestampe_ss(&tm); + CWM_OS_dbgPrintf("ar alert type : %d tm :%d \n",(int)sensorEVT->fData[1],tm); int ar_alert_type = (int)sensorEVT->fData[1]; CustomEventPublish(TOPIC_EVENT_AR_ALERT_TYPE_UPDATE,&ar_alert_type,sizeof(int)); @@ -1718,10 +1738,10 @@ int cywee_main_dml(void) //设置抬腕功能 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; - // scl.iData[1] = 5; - // scl.iData[2] = 5; - // scl.iData[3] = 5; - // scl.iData[4] = 5; + scl.iData[1] = 6; + scl.iData[2] = 5; + scl.iData[3] = 5; + scl.iData[4] = 4; CWM_SettingControl(SCL_HAND_UPDOWN_CONFIG, &scl); //配置跑步机模式相关参数(进入跑步机模式自动生效) @@ -1826,6 +1846,7 @@ int cwm_lib_process(void) //运行算法 void cywee_int_handler(void) { + timeout = 1; // if(cywee_switch == 1) { #ifdef AP_ENABLE_DML_SDO_LISTEN diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 152079c81..a15c054ae 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -117,8 +117,8 @@ const int32_t spo2_ir_unwear_thres = 8000; //demo143b 25000 30000 const int32_t spo2_ir_wear_thres = 10000; const uint8_t spo2_ir_wear_offset = 15; //CHECK_WEAR_MODE_THRES -const int32_t check_mode_unwear_thre = 8000; -const int32_t check_mode_wear_thre = 10000; +const int32_t check_mode_unwear_thre = 25000; +const int32_t check_mode_wear_thre = 30000; uint8_t alg_ram[11 * 1024] __attribute__((aligned(4))); @@ -131,7 +131,7 @@ static int cywee_wear_status = 0; static uint8_t hx3695_chip_id = 0; -static int timeout = 0; +// static int timeout = 0; //////// spo2 para and switches const uint8_t COUNT_BLOCK_NUM = 25; //delay the block of some single good signal after a series of bad signal @@ -2755,7 +2755,7 @@ hrs_sensor_data_t hrs_s_dat; static uint8_t his_wear = 2; static uint8_t wear_cnt = 0; -static uint8_t acc_restart_flag = 0; +// static uint8_t acc_restart_flag = 0; void hx3695_hrs_ppg_Int_handle(void) { @@ -2836,20 +2836,20 @@ void hx3695_hrs_ppg_Int_handle(void) for(ii=0; ii<*count; ii++) { - if(gsensordata[ii].x == 0.0f && gsensordata[ii].y == 0.0f && gsensordata[ii].z == 0.0f) - { - timeout++; - if(timeout > 20 && !acc_restart_flag) //避免重复开关gsensor - { - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESTART_ACC,NULL); - acc_restart_flag = 1; - } - } - else - { - timeout = 0; - acc_restart_flag = 0; - } + // if(gsensordata[ii].x == 0.0f && gsensordata[ii].y == 0.0f && gsensordata[ii].z == 0.0f) + // { + // timeout++; + // if(timeout > 20 && !acc_restart_flag) //避免重复开关gsensor + // { + // do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESTART_ACC,NULL); + // acc_restart_flag = 1; + // } + // } + // else + // { + // timeout = 0; + // acc_restart_flag = 0; + // } if(ii == 8) { gsen_fifo_x_send[ii] = gsen_fifo_x_send[ii - 1];