extern int left_press_low; void cal_step_data(void) { static int step_count_sum = 0; step_count = 1; step_count_sum += step_count; 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])); if(step_length > 5.0f) { step_length = 1.2f; } step_distance = (uint16_t)(step_length * 100.0f); sen_step_to_host(step_count, step_distance); }