sport_data.c 458 B

12345678910111213141516171819202122
  1. extern int left_press_low;
  2. void cal_step_data(void)
  3. {
  4. static int step_count_sum = 0;
  5. step_count = 1;
  6. step_count_sum += step_count;
  7. float step_length = sqrt((last_pos_n[0] - pos_n[0])*(last_pos_n[0] - pos_n[0]) + (last_pos_n[1] - pos_n[1])*(last_pos_n[1] - pos_n[1]));
  8. if(step_length > 5.0f)
  9. {
  10. step_length = 1.2f;
  11. }
  12. step_distance = (uint16_t)(step_length * 100.0f);
  13. sen_step_to_host(step_count, step_distance);
  14. }