press_down_detect.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. #include "press_down_detect.h"
  2. int back_jump_stage = 0;
  3. int cancel_down = 0;
  4. int virus_flag = 0;
  5. float real_front_min_left = 50000.f;
  6. float real_front_min_right = 50000.f;
  7. int press_down_detect_new(int index, float front_mag_left, float back_mag_left,
  8. float front_mag_right, float back_mag_right,
  9. float left_acc_x,float left_acc_y, float left_acc_z, float right_acc_x, float right_acc_y, float right_acc_z,
  10. int *front_down, int *back_down)
  11. {
  12. static float front_mag_norm_left[PRESS_COUNT_MAX];
  13. static float front_mag_norm_right[PRESS_COUNT_MAX];
  14. static float back_mag_norm_left[PRESS_COUNT_MAX];
  15. static float back_mag_norm_right[PRESS_COUNT_MAX];
  16. static float left_acc_x_window[10];
  17. static float left_acc_y_window[10];
  18. static float left_acc_z_window[10];
  19. static float right_acc_x_window[10];
  20. static float right_acc_y_window[10];
  21. static float right_acc_z_window[10];
  22. static int down_count_down = 0;
  23. static int special_down_count_down = 0;
  24. memcpy(front_mag_norm_left, front_mag_norm_left + 1, (PRESS_COUNT_MAX - 1) * sizeof(float));
  25. front_mag_norm_left[PRESS_COUNT_MAX - 1] = front_mag_left;
  26. memcpy(back_mag_norm_left, back_mag_norm_left + 1, (PRESS_COUNT_MAX - 1) * sizeof(float));
  27. back_mag_norm_left[PRESS_COUNT_MAX - 1] = back_mag_left;
  28. memcpy(front_mag_norm_right, front_mag_norm_right + 1, (PRESS_COUNT_MAX - 1) * sizeof(float));
  29. front_mag_norm_right[PRESS_COUNT_MAX - 1] = front_mag_right;
  30. memcpy(back_mag_norm_right, back_mag_norm_right + 1, (PRESS_COUNT_MAX - 1) * sizeof(float));
  31. back_mag_norm_right[PRESS_COUNT_MAX - 1] = back_mag_right;
  32. /*
  33. * 三轴加速度的滑动窗口
  34. */
  35. memcpy(left_acc_x_window, left_acc_x_window + 1, 9 * sizeof(float));
  36. left_acc_x_window[9] = left_acc_x;
  37. memcpy(left_acc_y_window, left_acc_y_window + 1, 9 * sizeof(float));
  38. left_acc_y_window[9] = left_acc_y;
  39. memcpy(left_acc_z_window, left_acc_z_window + 1, 9 * sizeof(float));
  40. left_acc_z_window[9] = left_acc_z;
  41. memcpy(right_acc_x_window, right_acc_x_window + 1, 9 * sizeof(float));
  42. right_acc_x_window[9] = right_acc_x;
  43. memcpy(right_acc_y_window, right_acc_y_window + 1, 9 * sizeof(float));
  44. right_acc_y_window[9] = right_acc_y;
  45. memcpy(right_acc_z_window, right_acc_z_window + 1, 9 * sizeof(float));
  46. right_acc_z_window[9] = right_acc_z;
  47. int front_down_tmp = 0;
  48. int back_down_tmp = 0;
  49. float left_max_front_val = front_mag_left;
  50. float left_min_front_val = front_mag_left;
  51. int left_min_front_index = PRESS_COUNT_MAX - 1;
  52. int left_max_front_index = PRESS_COUNT_MAX - 1;
  53. float left_max_back_val = back_mag_left;
  54. float left_min_back_val = back_mag_left;
  55. int left_min_back_index = PRESS_COUNT_MAX - 1;
  56. int left_max_back_index = PRESS_COUNT_MAX - 1;
  57. float right_max_front_val = front_mag_right;
  58. float right_min_front_val = front_mag_right;
  59. int right_min_front_index = PRESS_COUNT_MAX - 1;
  60. int right_max_front_index = PRESS_COUNT_MAX - 1;
  61. float right_max_back_val = back_mag_right;
  62. float right_min_back_val = back_mag_right;
  63. int right_min_back_index = PRESS_COUNT_MAX - 1;
  64. int right_max_back_index = PRESS_COUNT_MAX - 1;
  65. for(int i = 0; i < PRESS_COUNT_MAX; i++)
  66. {
  67. if(front_mag_norm_left[i] > left_max_front_val)
  68. {
  69. left_max_front_val = front_mag_norm_left[i];
  70. left_max_front_index = i;
  71. }
  72. if(front_mag_norm_left[i] < left_min_front_val)
  73. {
  74. left_min_front_val = front_mag_norm_left[i];
  75. left_min_front_index = i;
  76. }
  77. if(back_mag_norm_left[i] > left_max_back_val)
  78. {
  79. left_max_back_val = back_mag_norm_left[i];
  80. left_max_back_index = i;
  81. }
  82. if(back_mag_norm_left[i] < left_min_back_val)
  83. {
  84. left_min_back_val = back_mag_norm_left[i];
  85. left_min_back_index = i;
  86. }
  87. if(front_mag_norm_right[i] > right_max_front_val)
  88. {
  89. right_max_front_val = front_mag_norm_right[i];
  90. right_max_front_index = i;
  91. }
  92. if(front_mag_norm_right[i] < right_min_front_val)
  93. {
  94. right_min_front_val = front_mag_norm_right[i];
  95. right_min_front_index = i;
  96. }
  97. if(back_mag_norm_right[i] > right_max_back_val)
  98. {
  99. right_max_back_val = back_mag_norm_right[i];
  100. right_max_back_index = i;
  101. }
  102. if(back_mag_norm_right[i] < right_min_back_val)
  103. {
  104. right_min_back_val = back_mag_norm_right[i];
  105. right_min_back_index = i;
  106. }
  107. }
  108. /*
  109. * 平稳状态测试
  110. */
  111. float left_acc_x_min = left_acc_x;
  112. float left_acc_x_max = left_acc_x;
  113. float left_acc_y_min = left_acc_y;
  114. float left_acc_y_max = left_acc_y;
  115. float left_acc_z_min = left_acc_z;
  116. float left_acc_z_max = left_acc_z;
  117. float right_acc_x_min = right_acc_x;
  118. float right_acc_x_max = right_acc_x;
  119. float right_acc_y_min = right_acc_y;
  120. float right_acc_y_max = right_acc_y;
  121. float right_acc_z_min = right_acc_z;
  122. float right_acc_z_max = right_acc_z;
  123. for(int i = 0; i < 10; i++)
  124. {
  125. if(left_acc_x_window[i] > left_acc_x_max)
  126. {
  127. left_acc_x_max = left_acc_x_window[i];
  128. }
  129. if(left_acc_x_window[i] < left_acc_x_min)
  130. {
  131. left_acc_x_min = left_acc_x_window[i];
  132. }
  133. if(left_acc_y_window[i] > left_acc_y_max)
  134. {
  135. left_acc_y_max = left_acc_y_window[i];
  136. }
  137. if(left_acc_y_window[i] < left_acc_y_min)
  138. {
  139. left_acc_y_min = left_acc_y_window[i];
  140. }
  141. if(left_acc_z_window[i] > left_acc_z_max)
  142. {
  143. left_acc_z_max = left_acc_z_window[i];
  144. }
  145. if(left_acc_z_window[i] < left_acc_z_min)
  146. {
  147. left_acc_z_min = left_acc_z_window[i];
  148. }
  149. if(right_acc_x_window[i] > right_acc_x_max)
  150. {
  151. right_acc_x_max = right_acc_x_window[i];
  152. }
  153. if(right_acc_x_window[i] < right_acc_x_min)
  154. {
  155. right_acc_x_min = right_acc_x_window[i];
  156. }
  157. if(right_acc_y_window[i] > right_acc_y_max)
  158. {
  159. right_acc_y_max = right_acc_y_window[i];
  160. }
  161. if(right_acc_y_window[i] < right_acc_y_min)
  162. {
  163. right_acc_y_min = right_acc_y_window[i];
  164. }
  165. if(right_acc_z_window[i] > right_acc_z_max)
  166. {
  167. right_acc_z_max = right_acc_z_window[i];
  168. }
  169. if(right_acc_z_window[i] < right_acc_z_min)
  170. {
  171. right_acc_z_min = right_acc_z_window[i];
  172. }
  173. }
  174. //判断前蹲
  175. if(left_max_front_index > left_min_front_index && left_max_front_val > left_min_front_val + 3000.0f
  176. && right_max_front_index > right_min_front_index && right_max_front_val > right_min_front_val + 3000.0f
  177. && abs(right_max_front_index - left_max_front_index) < 6)
  178. {
  179. front_down_tmp = 1;
  180. }
  181. // if(left_max_front_index > left_min_front_index && left_max_front_val > left_min_front_val + 200.0f)
  182. // {
  183. // real_front_min_left = real_front_min_left < left_min_front_val ? real_front_min_left : left_min_front_val;
  184. // }
  185. // else
  186. // {
  187. // real_front_min_left = 50000.f;
  188. // }
  189. //
  190. // if(right_max_front_index > right_min_front_index && right_max_front_val > right_min_front_val + 200.0f)
  191. // {
  192. // real_front_min_right = real_front_min_right < right_min_front_val ? real_front_min_right : right_min_front_val;
  193. // }
  194. // else
  195. // {
  196. // real_front_min_right = 50000.f;
  197. // }
  198. //
  199. // if(left_max_front_val - real_front_min_left > 1500.0f &&
  200. // right_max_front_val - real_front_min_right > 1500.0f &&
  201. // abs(left_max_front_index - right_max_front_index) < 10)
  202. // {
  203. //
  204. // down_count_down = 30;
  205. // }
  206. /*
  207. * 检测左右脚,左重右轻, 因为慢走会出现蹲的情况,添加这个逻辑
  208. */
  209. if((left_max_back_index < left_min_back_index && left_max_back_val > left_min_back_val + 2000.0f
  210. && right_max_back_val < right_min_back_val + 1000.0f) ||
  211. (right_max_back_index < right_min_back_index && right_max_back_val > right_min_back_val + 2000.0f &&
  212. left_max_back_val < left_min_back_val + 1000.0f)
  213. ||(right_max_back_index < right_min_back_index && right_max_back_val > right_min_back_val + 2000.0f &&
  214. left_max_back_index > left_min_back_index && left_max_back_val > left_min_back_val + 999.0f)
  215. ||(right_max_back_index > right_min_back_index && right_max_back_val > right_min_back_val + 999.0f &&
  216. left_max_back_index < left_min_back_index && left_max_back_val > left_min_back_val + 2000.0f))
  217. {
  218. front_down_tmp = 0;
  219. }
  220. /*
  221. * 有一脚前踩,有一只先踩了,但是待另一只脚落地,会出现后脚压力变小的情况
  222. */
  223. if(right_max_back_val > back_mag_right + 3000.0f && left_max_front_val - real_front_min_left > 3000.0f)
  224. {
  225. // back_down_tmp = 1;
  226. special_down_count_down = 30;
  227. }
  228. if(left_max_back_val > back_mag_left + 3000.0f && right_max_front_val - real_front_min_right > 3000.0f)
  229. {
  230. // back_down_tmp = 1;
  231. special_down_count_down = 30;
  232. }
  233. /*
  234. * 检测左右脚,踩得比较及时,同时比较用力
  235. */
  236. if(right_max_back_index < right_min_back_index && right_max_back_val > right_min_back_val + 2000.0f
  237. && left_max_back_index > left_min_back_index && left_max_back_val > left_min_back_val + 2000.0f)
  238. {
  239. down_count_down = 0;
  240. }
  241. /*
  242. * 根据情况删除延时等待
  243. */
  244. if(right_max_back_index > right_min_back_index && right_max_back_val > right_min_back_val + 2000.0f
  245. && left_max_back_index < left_min_back_index && left_max_back_val > left_min_back_val + 2000.0f)
  246. {
  247. down_count_down = 0;
  248. }
  249. if(left_max_front_index < left_min_front_index && left_max_front_val > left_min_front_val + 3000.0f)
  250. {
  251. down_count_down = 0;
  252. special_down_count_down = 0;
  253. }
  254. if(right_max_front_index < right_min_front_index && right_max_front_val > right_min_front_val + 3000.0f)
  255. {
  256. down_count_down = 0;
  257. special_down_count_down = 0;
  258. }
  259. if((right_max_back_index < right_min_back_index && right_max_back_val > right_min_back_val + 2000.0f
  260. && left_max_back_index > left_min_back_index && left_max_back_val > left_min_back_val + 2000.0f) ||
  261. (right_max_back_index > right_min_back_index && right_max_back_val > right_min_back_val + 2000.0f
  262. && left_max_back_index < left_min_back_index && left_max_back_val > left_min_back_val + 2000.0f))
  263. {
  264. special_down_count_down = 0;
  265. }
  266. if(left_acc_x_max - left_acc_x_min < 0.15f &&
  267. right_acc_x_max - right_acc_x_min < 0.15f &&
  268. down_count_down > 0)
  269. {
  270. front_down_tmp = 1;
  271. }
  272. if(left_acc_z_max - left_acc_z_min < 0.1f && right_acc_z_max - right_acc_z_min < 0.1f &&
  273. left_acc_y_max - left_acc_y_min < 0.1f && right_acc_y_max - right_acc_y_min < 0.1f &&
  274. left_acc_x_max - left_acc_x_min < 0.1f && right_acc_x_max - right_acc_x_min < 0.1f &&
  275. special_down_count_down > 0)
  276. {
  277. back_down_tmp = 1;
  278. }
  279. if(down_count_down > 0)
  280. {
  281. down_count_down --;
  282. }
  283. if(special_down_count_down > 0)
  284. {
  285. special_down_count_down --;
  286. }
  287. // if(left_max_back_index > left_min_back_index && left_max_back_val > left_min_back_val + 2000.0f
  288. // && right_max_back_index > right_min_back_index && right_max_back_val > right_min_back_val + 2000.0f
  289. // && abs(right_max_back_index - left_max_back_index) < 4)
  290. // {
  291. // back_down_tmp = 1;
  292. // }
  293. if(right_max_back_index > right_min_back_index && right_max_back_val > right_min_back_val + 3000.0f
  294. && left_max_back_index > left_min_back_index && left_max_back_val > left_min_back_val + 3000.0f &&
  295. abs(right_max_front_index - left_max_front_index) < 15
  296. && left_acc_x_max - left_acc_x_min < 0.15f && right_acc_x_max - right_acc_x_min < 0.15f )
  297. {
  298. back_down_tmp = 1;
  299. }
  300. // if(right_max_back_index > right_min_back_index && right_max_back_val > right_min_back_val + 2000.0f
  301. // && left_max_back_index > left_min_back_index && left_max_back_val > left_min_back_val + 2000.0f
  302. // && back_mag_norm_right[0] > 15000.0f && back_mag_norm_left[0] > 15000.0f && right_max_back_val > 15000.0f && right_max_back_val > 15000.0f
  303. // && abs(right_max_front_index - left_max_front_index) < 6
  304. // && left_acc_x_max - left_acc_x_min < 0.15f && right_acc_x_max - right_acc_x_min < 0.15f )
  305. // {
  306. // back_down_tmp = 1;
  307. // }
  308. *front_down = front_down_tmp;
  309. *back_down = back_down_tmp;
  310. return 0;
  311. }
  312. //short press_jump_detect(int16_t *h_pos, int16_t *s_pos)
  313. //{
  314. // static int last_h_z;
  315. // static int last_s_z;
  316. // static int left_up;
  317. // static int right_up;
  318. //
  319. // static int left_up_count;
  320. // static int right_up_count;
  321. //
  322. // if(h_pos[2] - last_h_z > 0 && h_pos[2]> 0)
  323. // {
  324. // left_up = 1;
  325. // }
  326. // else if((h_pos[2] - last_h_z < 0) || h_pos[2] <= 0)
  327. // {
  328. // left_up = -1;
  329. // }
  330. //
  331. // if(left_up == 1)
  332. // {
  333. // left_up_count ++;
  334. // }
  335. // else
  336. // {
  337. // left_up_count = 0;
  338. // }
  339. //
  340. // if(s_pos[2] - last_s_z > 0 && s_pos[2] > 0)
  341. // {
  342. // right_up = 1;
  343. // }
  344. // else if((s_pos[2] - last_s_z < 0) || s_pos[2] <= 0)
  345. // {
  346. // right_up = -1;
  347. // }
  348. //
  349. // if(right_up == 1)
  350. // {
  351. // right_up_count ++;
  352. // }
  353. // else
  354. // {
  355. // right_up_count = 0;
  356. // }
  357. //
  358. // last_h_z = h_pos[2];
  359. // last_s_z = s_pos[2];
  360. //
  361. // if(left_up == 1 && right_up == 1 && right_up_count < 15 && left_up_count < 20
  362. // && right_up_count > 2 && left_up_count > 2)
  363. // {
  364. // return 1;
  365. // }
  366. //
  367. // return 0;
  368. //}
  369. //由于仅靠IMU来探测触底了,高度估计得不太对,所以用加速度来算起跳动作
  370. void max_min_window(float *data, int length, float *max_val , int *max_index, float * min_val, int *min_index)
  371. {
  372. *max_val = data[0];
  373. *max_index = 0;
  374. *min_val = data[0];
  375. *min_index = 0;
  376. for(int i = 0; i < length; i++)
  377. {
  378. if(*max_val < data[i])
  379. {
  380. *max_val = data[i];
  381. *max_index = i;
  382. }
  383. if(*min_val > data[i])
  384. {
  385. *min_val = data[i];
  386. *min_index = i;
  387. }
  388. }
  389. }
  390. //short press_jump_detect(float left_acc_z, float right_acc_z, int left_zupt, int right_zupt, int left_front_press, int right_front_press)
  391. //{
  392. //
  393. // static float right_data_z_buff[10];
  394. // static float left_data_z_buff[10];
  395. //
  396. // static int last_right_press;
  397. // static int last_left_press;
  398. // static int left_max_press;
  399. // static int right_max_press;
  400. //
  401. // static int wait;
  402. //
  403. // /*
  404. // * 存储数据
  405. // */
  406. // memcpy(right_data_z_buff, right_data_z_buff + 1, 9 * sizeof(float));
  407. //
  408. // memcpy(left_data_z_buff, left_data_z_buff + 1, 9 * sizeof(float));
  409. //
  410. // right_data_z_buff[9] = right_acc_z;
  411. // left_data_z_buff[9] = left_acc_z;
  412. //
  413. // if(left_zupt && right_zupt)
  414. // {
  415. // wait = 30;
  416. // }
  417. //
  418. // /*
  419. // * 检测压力下降用的逻辑
  420. // */
  421. // if(last_left_press - left_front_press > 200)
  422. // {
  423. // if(last_left_press > left_max_press)
  424. // {
  425. // left_max_press = last_left_press;
  426. // }
  427. // }
  428. // else if(last_left_press - left_front_press < -200)
  429. // {
  430. // left_max_press = 0;
  431. // }
  432. //
  433. // last_left_press = left_front_press;
  434. //
  435. // if(last_right_press - right_front_press > 200)
  436. // {
  437. // if(last_right_press > right_max_press)
  438. // {
  439. // right_max_press = last_right_press;
  440. // }
  441. // }
  442. // else if(last_right_press - right_front_press < -200)
  443. // {
  444. // right_max_press = 0;
  445. // }
  446. //
  447. // last_right_press = right_front_press;
  448. //
  449. // /*
  450. // * 加速变化估计
  451. // */
  452. //
  453. // float max_val_right, min_val_right, max_val_left, min_val_left;
  454. //
  455. // int max_index_right, min_index_right, max_index_left, min_index_left;
  456. //
  457. //
  458. // max_min_window(right_data_z_buff, 10, &max_val_right , &max_index_right, &min_val_right, &min_index_right);
  459. //
  460. // max_min_window(left_data_z_buff, 10, &max_val_left , &max_index_left, &min_val_left, &min_index_left);
  461. //
  462. // if(wait > 0)
  463. // {
  464. // wait --;
  465. // }
  466. //
  467. // /*
  468. // * 1.0f的阈值轻轻跳就可以达到了,现在改为1.3f的阈值
  469. // */
  470. // if( max_index_right < min_index_right && max_index_left < min_index_left &&
  471. //
  472. // max_val_right - min_val_right > 1.3f && max_val_left - min_val_left > 1.3f && wait > 0 && left_zupt == 0 && right_zupt == 0
  473. //
  474. // && left_max_press - left_front_press > 3000 && right_max_press - right_front_press > 3000 )
  475. // //if(left_max_press - left_front_press > 3000 && right_max_press - right_front_press > 3000)
  476. // {
  477. // SEGGER_RTT_printf(0, "test\n");
  478. // SEGGER_RTT_printf(0," left_max_press - left_front_press= %d , right_max_press - right_front_press = %d\n", left_max_press - left_front_press, right_max_press - right_front_press);
  479. // return 1;
  480. // }
  481. //
  482. // return 0;
  483. //
  484. //}
  485. short press_jump_detect(float left_acc_z, float right_acc_z, int left_zupt, int right_zupt, int left_front_press, int right_front_press)
  486. {
  487. static float right_data_z_buff[10];
  488. static float left_data_z_buff[10];
  489. static float right_data_press[10];
  490. static float left_data_press[10];
  491. static int wait;
  492. /*
  493. * 存储数据
  494. */
  495. memcpy(right_data_z_buff, right_data_z_buff + 1, 9 * sizeof(float));
  496. memcpy(left_data_z_buff, left_data_z_buff + 1, 9 * sizeof(float));
  497. memcpy(right_data_press, right_data_press + 1, 9 * sizeof(float));
  498. memcpy(left_data_press, left_data_press + 1, 9 * sizeof(float));
  499. right_data_z_buff[9] = right_acc_z; left_data_z_buff[9] = left_acc_z;
  500. right_data_press[9] = right_front_press; left_data_press[9] = left_front_press;
  501. if(left_zupt && right_zupt)
  502. {
  503. wait = 30;
  504. }
  505. /*
  506. * 检测压力下降用的逻辑
  507. */
  508. float max_val_right_press, min_val_right_press, max_val_left_press, min_val_left_press;
  509. int max_index_right_press, min_index_right_press, max_index_left_press, min_index_left_press;
  510. max_min_window(right_data_press, 10, &max_val_right_press , &max_index_right_press, &min_val_right_press, &min_index_right_press);
  511. max_min_window(left_data_press, 10, &max_val_left_press , &max_index_left_press, &min_val_left_press, &min_index_left_press);
  512. /*
  513. * 加速变化估计
  514. */
  515. float max_val_right, min_val_right, max_val_left, min_val_left;
  516. int max_index_right, min_index_right, max_index_left, min_index_left;
  517. max_min_window(right_data_z_buff, 10, &max_val_right , &max_index_right, &min_val_right, &min_index_right);
  518. max_min_window(left_data_z_buff, 10, &max_val_left , &max_index_left, &min_val_left, &min_index_left);
  519. if(wait > 0)
  520. {
  521. wait --;
  522. }
  523. /*
  524. * 1.0f的阈值轻轻跳就可以达到了,现在改为1.3f的阈值
  525. */
  526. if( max_index_right < min_index_right && max_index_left < min_index_left &&
  527. max_val_right - min_val_right > 0.8f && max_val_left - min_val_left > 0.8f && wait > 0 && left_zupt == 0 && right_zupt == 0
  528. && max_index_right_press < min_index_right_press && max_index_left_press < min_index_left_press &&
  529. max_val_right_press - min_val_right_press > 3000.f && max_val_left_press - min_val_left_press > 3000.f)
  530. //if(left_max_press - left_front_press > 3000 && right_max_press - right_front_press > 3000)
  531. {
  532. // SEGGER_RTT_printf(0, "test\n");
  533. return 1;
  534. }
  535. return 0;
  536. }