#include "app_math.h" #include "bsp_time.h" #include "system.h" #include "hal_imu.h" #include "hal_mode_manage.h" #include "math.h" #include "ble_comm.h" #include "app_flash.h" #include "detect_zero_vel.h" #include "tool.h" #include "app_switchimu.h" #include "detect_step_by_mag.h" static int16_t acc_front[IMU_BUFF_SIZE][3]; static int16_t gry_front[IMU_BUFF_SIZE][3]; static int16_t mag6310_front[IMU_BUFF_SIZE][3]; static int16_t mag6310_back[3]; static int32_t timestamp_front[IMU_BUFF_SIZE]; static uint8_t rssi; static int16_t IMU_STATUS; //记录状态用来重新记录时间戳 static int32_t timestamp; static int32_t last_timestamp; void process_imu_data_front(int front_index) { if(IMU_STATUS != 1) { IMU_STATUS = 1; last_timestamp = timestamp_front[0]; timestamp = 0; } for(int i = 0; i < front_index; i++) { int32_t dt = timestamp_front[i] - last_timestamp; if(dt > 20000 || dt < 0) { dt = 10000; } timestamp += dt; last_timestamp = timestamp_front[i]; // SEGGER_RTT_printf(0,"timestamp_front[i] : %d; i = %d\r\n", timestamp_front[i], i); IMU_Process_motion_queue(mFlash.isHost, timestamp, acc_front[i], gry_front[i],mag6310_front[i], mag6310_back, rssi); } } void app_math_TimerCounter(void) { int16_t group_num = 0; //游戏模式 if(hal_mode_get() == HAL_MODE_GAME){ // CHECK_TIMECONSUMING_START; rssi = 0-host_get_rssi(); group_num = IMU_Get_Front_Data_Num(); for(int i=0;i>>>>>isLoader:%d\r\n",mFlash.mStep.stepCur[0]); break; } } } } //static void hal_stepSaveTest_process(void){ // mFlash.mStep.stepCur[0]++; //// Flash_SaveStep(); // SEGGER_RTT_printf(0,"hal step Save one minute:step %d\r\n",mFlash.mStep.stepCur[0]); //} void app_math_Init(void) { Process_Start(100,"app_math_DailyStep_Process",app_math_DailyStep_Process); Process_Start(10,"app_math_TimerCounter",app_math_TimerCounter); // if(mFlash.isHost)Process_Start(10000,"hal_stepSaveTest",hal_stepSaveTest_process); }