From: p15692025051 <846603105@qq.com> Date: Thu, 11 Jul 2024 09:11:18 +0000 (+0800) Subject: 跌倒报警更新 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=271362682ef7de39e2010e300e3888c2bb0e55fc;p=mirrors%2FASR3603_Z5_DS.git 跌倒报警更新 --- diff --git a/2.sdk/sdk/gui/lv_drivers/indev/my_xMotion.c b/2.sdk/sdk/gui/lv_drivers/indev/my_xMotion.c index 2ec0e0c3..2446b8bf 100644 --- a/2.sdk/sdk/gui/lv_drivers/indev/my_xMotion.c +++ b/2.sdk/sdk/gui/lv_drivers/indev/my_xMotion.c @@ -310,7 +310,7 @@ typedef struct float y; float z; }acc_g_data_t; -static uint16_t fall_counter = 0; +uint16_t fall_counter = 0; #if fall_detect_debug extern int count_13 ; extern int count_14 ; @@ -323,10 +323,12 @@ extern int count_8 ; extern int count_7 ; #endif int fall_detect_count = 0; +int acc_square_14 = 0; +double acc_square =0; uint8_t gsensor_sc7a20_fall_detect(acc_g_data_t * acc) { double acc_square_t = (double)((acc->x) * (acc->x)) + (double)((acc->y) * (acc->y)) + (double)((acc->z) * (acc->z)); - double acc_square = sqrt(acc_square_t); + acc_square = sqrt(acc_square_t); // if(MMIApi_IsOpenGsensorTestWin()) // { // memcpy(&s_sc7a20_test_info, acc, sizeof(acc_g_data_t)); @@ -359,14 +361,20 @@ uint8_t gsensor_sc7a20_fall_detect(acc_g_data_t * acc) if(acc_square < FALL_DETECH_LOW_THRESHOLD )//7)// { fall_counter++; + }else if(acc_square >= 14)//加速 + { + acc_square_14++; } + //else if(fall_detect_count >= 32*3) + //if(acc_square_14 == 0 || fall_detect_count >= 32*3 ) { fall_detect_count = 0; fall_counter = 0; + acc_square_14=0; } - if(fall_counter >= FALL_COUNTER_THRESHOLD) //10)// + if(fall_counter >= FALL_COUNTER_THRESHOLD && acc_square_14 >=FALL_COUNTER_THRESHOLD/2) //10)// { fall_counter = 0; @@ -434,11 +442,11 @@ static void My_Motion_Main(VOID * argv) s_acc.y = ((float)Gsensor_y[i]/100); s_acc.z = ((float)Gsensor_z[i]/100); //cplog_printf("x:%d,y:%d,z:%d!!!\n",Gsensor_x[i],Gsensor_y[i],Gsensor_z[i]); - if(gsensor_sc7a20_fall_detect(&s_acc) == 1)//跌倒报警 - { - //cplog_printf("mmi_gsensor_sensor_fall_alarm x:%d,y:%d,z:%d!!!\n",Gsensor_x[i],Gsensor_y[i],Gsensor_z[i]); - mmi_gsensor_sensor_fall_alarm(); - } + // if(gsensor_sc7a20_fall_detect(&s_acc) == 1)//跌倒报警 + // { + // //cplog_printf("mmi_gsensor_sensor_fall_alarm x:%d,y:%d,z:%d!!!\n",Gsensor_x[i],Gsensor_y[i],Gsensor_z[i]); + // mmi_gsensor_sensor_fall_alarm(); + // } } #if USE_HX3918 @@ -792,7 +800,8 @@ int xMotion_my_init() xMotion_Set_Raise_Parma(0); xMotion_Control(SHAKE_X,ENABLE_X);//shake xMotion_Control(PEDOMETER_X, ENABLE_X); //pedometer - + xMotion_Set_Fall_Parma(3);//设置灵敏度,有效范围[1~5] , 默认为 3 (最灵敏); + xMotion_Control(FALL_X,ENABLE_X);// 打开跌倒检测算法 sedentary_control(1);//0:on 1:off 2:auto raisehand_control(hal_xmotion_raisehand_sw_read()); diff --git a/2.sdk/sdk/product/craneg_modem/cust/xMotion/inc/xMotion.h b/2.sdk/sdk/product/craneg_modem/cust/xMotion/inc/xMotion.h index 2fc19786..d3c4359e 100644 --- a/2.sdk/sdk/product/craneg_modem/cust/xMotion/inc/xMotion.h +++ b/2.sdk/sdk/product/craneg_modem/cust/xMotion/inc/xMotion.h @@ -33,7 +33,7 @@ Macro definitions - Algorithm Build Options #define ANDROID 0 #define PEDOMETER_ENABLE 1 -#define FALL_ENABLE 0 +#define FALL_ENABLE 1 #define SLEEP_ENABLE 0 #define SEDENTARY_ENABLE 1 #define FLIP_ENABLE 0 diff --git a/2.sdk/sdk/product/craneg_modem/cust/xMotion/lib/xMotion.a b/2.sdk/sdk/product/craneg_modem/cust/xMotion/lib/xMotion.a index a364daf9..426b4f19 100644 Binary files a/2.sdk/sdk/product/craneg_modem/cust/xMotion/lib/xMotion.a and b/2.sdk/sdk/product/craneg_modem/cust/xMotion/lib/xMotion.a differ