Merge branch 'main' of http://106.52.233.130:3000/helloyifa/bk7258_iR58
This commit is contained in:
commit
d54fd916e7
@ -232,7 +232,7 @@ static void shake_set_onoff(unsigned char onoff)
|
|||||||
shake_alg_param.shake_threshold_v = 140;
|
shake_alg_param.shake_threshold_v = 140;
|
||||||
shake_alg_param.stability_threshold_v = 130;
|
shake_alg_param.stability_threshold_v = 130;
|
||||||
shake_alg_param.shake_check_number = 1;
|
shake_alg_param.shake_check_number = 1;
|
||||||
shake_alg_param.shake_time_limit_ms = 800;
|
shake_alg_param.shake_time_limit_ms = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void shake_arithmetic_set_parameter(shake_recognition_alg_param_t *shake_alg_p)
|
void shake_arithmetic_set_parameter(shake_recognition_alg_param_t *shake_alg_p)
|
||||||
@ -313,6 +313,8 @@ void shake_arithmetic_set_parameter(shake_recognition_alg_param_t *shake_alg_p)
|
|||||||
|
|
||||||
signed short prev_x = 0, prev_y = 0, prev_z = 0; // 记录上一次的三轴数据
|
signed short prev_x = 0, prev_y = 0, prev_z = 0; // 记录上一次的三轴数据
|
||||||
int first = 0;
|
int first = 0;
|
||||||
|
|
||||||
|
uint64_t gsen_last_time = 0;
|
||||||
static void shake_arithmetic_task_handler(void *param)
|
static void shake_arithmetic_task_handler(void *param)
|
||||||
{
|
{
|
||||||
signed short x;//, y, z;
|
signed short x;//, y, z;
|
||||||
@ -331,14 +333,14 @@ static void shake_arithmetic_task_handler(void *param)
|
|||||||
//os_printf("%s: Entering the function.\n", __func__); // 添加进入函数的日志
|
//os_printf("%s: Entering the function.\n", __func__); // 添加进入函数的日志
|
||||||
|
|
||||||
/* if shake close, so return. */
|
/* if shake close, so return. */
|
||||||
if (0 == shake_info.onoff) {
|
// if (0 == shake_info.onoff) {
|
||||||
os_printf("%s: Shake detection is off, returning.\n", __func__);
|
// os_printf("%s: Shake detection is off, returning.\n", __func__);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
uint64_t timestmp = 0;
|
uint64_t timestmp = 0;
|
||||||
uint64_t shake_t_l_ms = shake_alg_param.shake_time_limit_ms;
|
uint64_t shake_t_l_ms = shake_alg_param.shake_time_limit_ms;
|
||||||
|
//uint64_t shake_t_l_ms = 800;
|
||||||
for (unsigned int i = 0; i < count; i += 3) {
|
for (unsigned int i = 0; i < count; i += 3) {
|
||||||
/* get x,y,z data */
|
/* get x,y,z data */
|
||||||
x = data_buf[i+0];
|
x = data_buf[i+0];
|
||||||
@ -361,9 +363,19 @@ static void shake_arithmetic_task_handler(void *param)
|
|||||||
// 判断差值是否超过阈值
|
// 判断差值是否超过阈值
|
||||||
if (diff_x > diff_threshold ) {
|
if (diff_x > diff_threshold ) {
|
||||||
timestmp = bk_aon_rtc_get_ms();
|
timestmp = bk_aon_rtc_get_ms();
|
||||||
|
|
||||||
|
// os_printf("%s timestmp:%llu gsen_last_time:%llu gsen_last_time + shake_t_l_ms:%llu shake_t_l_ms :%llu\r\n", __func__, timestmp, gsen_last_time, gsen_last_time + shake_t_l_ms,shake_t_l_ms);
|
||||||
// os_printf("%s: Difference exceeds the threshold, checking time condition.\n", __func__); // 添加差值超过阈值的日志
|
// os_printf("%s: Difference exceeds the threshold, checking time condition.\n", __func__); // 添加差值超过阈值的日志
|
||||||
if ((shake_info.last_time + shake_t_l_ms) < timestmp) {
|
if ((gsen_last_time + shake_t_l_ms) < timestmp) {
|
||||||
shake_info.last_time = timestmp;
|
|
||||||
|
// os_printf("limiande %s: timestmp=%llu, last_time=%llu, threshold=%llu shake_t_l_ms= %llu\r\n",
|
||||||
|
//__func__, timestmp, gsen_last_time, gsen_last_time + shake_t_l_ms,shake_t_l_ms);
|
||||||
|
gsen_last_time = timestmp;
|
||||||
|
|
||||||
|
// os_printf("Current timestmp: %llu\n", timestmp);
|
||||||
|
//bk_printf("gsen_last_time55555 %llu\r\n", gsen_last_time);
|
||||||
|
// bk_printf("gsen_last_time55555 %lu timestmp =%lu \r\n",gsen_last_time,timestmp);
|
||||||
|
|
||||||
rtos_delay_milliseconds(180);//过滤刚语音会闪灯
|
rtos_delay_milliseconds(180);//过滤刚语音会闪灯
|
||||||
if(first == 1 && get_binary_data_status() == 1){
|
if(first == 1 && get_binary_data_status() == 1){
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user