|
@@ -2,6 +2,8 @@
|
|
|
#include <stdint.h>
|
|
|
#include <string.h>
|
|
|
|
|
|
+extern void gpio_mt_run(uint32_t tim);
|
|
|
+
|
|
|
#define PRESS_LEGTH 15
|
|
|
#define DETECT_DOWN_SIZE 2
|
|
|
|
|
@@ -241,7 +243,7 @@ int press_down_detect_new(int index, int left_press, int right_press)
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (now_mean_min_val < last_mean_min_val || left_press < left_press_low + 100000 || right_press < right_press_low + 100000)
|
|
|
+ if (now_mean_min_val < last_mean_min_val || left_press < left_press_low + 200000 || right_press < right_press_low + 200000)
|
|
|
{
|
|
|
mean_up = 0;
|
|
|
mean_up_true = 0;
|
|
@@ -257,8 +259,8 @@ int press_down_detect_new(int index, int left_press, int right_press)
|
|
|
|
|
|
//if(mean_up_true > 20 && mean_max_val - mean_min_val > 500000)
|
|
|
if(mean_up_true > 15 &&
|
|
|
- (right_max_val - right_min_val > 750000 || left_max_val - left_min_val > 750000)
|
|
|
- && mean_max_val - mean_min_val > 200000)
|
|
|
+ (right_max_val - right_min_val > 600000 && left_max_val - left_min_val > 600000)
|
|
|
+ )
|
|
|
{
|
|
|
is_down = 1;
|
|
|
}
|
|
@@ -305,40 +307,29 @@ int press_down_detect_new(int index, int left_press, int right_press)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-short press_jump_detect(int index)
|
|
|
+short press_jump_detect(short *h_pos, short *s_pos)
|
|
|
{
|
|
|
- if(left_press_data[(index - 1) % PRESS_LEGTH] < left_press_low + 100000)
|
|
|
- {
|
|
|
- left_up_count = left_up_count + 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- left_up_count = 0;
|
|
|
- }
|
|
|
- if(right_press_data[(index - 1) % PRESS_LEGTH] < right_press_low + 100000)
|
|
|
- {
|
|
|
- right_up_count = right_up_count + 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- right_up_count = 0;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if(index >= 10)
|
|
|
+ if(h_pos[2] > 0)
|
|
|
{
|
|
|
- int max_left_press = max_press_window(left_press_data, PRESS_LEGTH);
|
|
|
- int max_right_press = max_press_window(right_press_data, PRESS_LEGTH);
|
|
|
-
|
|
|
- if( left_up_count < 10 && left_up_count> 0 &&
|
|
|
- right_up_count < 10 && right_up_count > 0&&
|
|
|
- (right_press_data[(index - 1) % PRESS_LEGTH] - max_right_press < -1000000
|
|
|
- || left_press_data[(index - 1) % PRESS_LEGTH] - max_left_press < -1000000)
|
|
|
- )
|
|
|
- {
|
|
|
- if(last_jump_stage == 0)
|
|
|
+ left_up_count = left_up_count + 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ left_up_count = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(s_pos[2] > 0)
|
|
|
+ {
|
|
|
+ right_up_count = right_up_count + 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ right_up_count = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(right_up_count > 0 && left_up_count > 0)
|
|
|
+ {
|
|
|
+ if(last_jump_stage == 0 && right_up_count < 15 && left_up_count < 15)
|
|
|
{
|
|
|
jump_count = jump_count + 1;
|
|
|
|
|
@@ -348,16 +339,66 @@ short press_jump_detect(int index)
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
last_jump_stage = 0;
|
|
|
|
|
|
return 0;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+//short press_jump_detect(int index)
|
|
|
+//{
|
|
|
+// if(left_press_data[(index - 1) % PRESS_LEGTH] < left_press_low + 100000)
|
|
|
+// {
|
|
|
+// left_up_count = left_up_count + 1;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// left_up_count = 0;
|
|
|
+// }
|
|
|
+
|
|
|
+// if(right_press_data[(index - 1) % PRESS_LEGTH] < right_press_low + 100000)
|
|
|
+// {
|
|
|
+// right_up_count = right_up_count + 1;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// right_up_count = 0;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// if(index >= 10)
|
|
|
+// {
|
|
|
+// int max_left_press = max_press_window(left_press_data, PRESS_LEGTH);
|
|
|
+// int max_right_press = max_press_window(right_press_data, PRESS_LEGTH);
|
|
|
+
|
|
|
+// if( left_up_count> 4 && right_up_count > 4
|
|
|
+//// (right_press_data[(index - 1) % PRESS_LEGTH] - max_right_press < -1000000
|
|
|
+//// || left_press_data[(index - 1) % PRESS_LEGTH] - max_left_press < -1000000)
|
|
|
+// )
|
|
|
+// {
|
|
|
+// if(last_jump_stage == 0)
|
|
|
+// {
|
|
|
+// jump_count = jump_count + 1;
|
|
|
+//
|
|
|
+// last_jump_stage = 1;
|
|
|
+//
|
|
|
+// return 1;
|
|
|
+// }
|
|
|
+//
|
|
|
+// return 0;
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// last_jump_stage = 0;
|
|
|
+//
|
|
|
+// return 0;
|
|
|
+//}
|
|
|
+
|
|
|
void press_minimum_eval(int left_press, int right_press, short h_pos_z, short s_pos_z)
|
|
|
{
|
|
|
if(right_press > right_press_max_val)
|
|
@@ -421,6 +462,8 @@ void press_minimum_eval(int left_press, int right_press, short h_pos_z, short s_
|
|
|
left_press_max_val = 0;
|
|
|
right_press_max_val = 0;
|
|
|
|
|
|
+// gpio_mt_run(500);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|