/* includes ----------------------------------------------------------*/ #include "task_handleData.h" /* typedef -----------------------------------------------------------*/ /* define ------------------------------------------------------------*/ /* macro -------------------------------------------------------------*/ /* variables ---------------------------------------------------------*/ /* function prototypes -----------------------------------------------*/ // 故障处理 尝试重新连接,并按照正常上传时间上传 void gyroscope_fault_deal(void){ uint8_t recBack = 0; if(BIT_CHECK(s_comData.Malfunction, gyroscope)){ turnFlag = 0; // 按照正常上传时间上传 recBack = atk_ms6050_init(); if(recBack != 0){ printf("ATK-MS6050 init failed!\r\n"); return; } printf("ATK-MS6050 init\r\n"); recBack = atk_ms6050_dmp_init(); if(recBack != 0){ printf("ATK-MS6050 DMP init failed!\r\n"); return; } printf("ATK-MS6050 DMP init!\r\n"); BIT_CLEAR(s_comData.Malfunction, gyroscope); } } /** * @brief 数据处理任务 * @param None * @note None * @retval None */ void task_handle_data(void){ // 检测是否正在升级固件 if(s_ec800Date.hardwareUpdate == 1){ osDelay(100); return; } // 陀螺仪故障处理 尝试重新连接 gyroscope_fault_deal(); // 判断车辆是否正在转弯 陀螺仪数据 if (isTurning()) { printf("The vehicle is turning.\r\n"); } else { printf("Vehicle not turning.\r\n"); } osDelay(1000); }