task_handleData(6607).c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* includes ----------------------------------------------------------*/
  2. #include "task_handleData.h"
  3. /* typedef -----------------------------------------------------------*/
  4. /* define ------------------------------------------------------------*/
  5. /* macro -------------------------------------------------------------*/
  6. /* variables ---------------------------------------------------------*/
  7. /* function prototypes -----------------------------------------------*/
  8. // 故障处理 尝试重新连接,并按照正常上传时间上传
  9. void gyroscope_fault_deal(void){
  10. uint8_t recBack = 0;
  11. if(BIT_CHECK(s_comData.Malfunction, gyroscope)){
  12. turnFlag = 0; // 按照正常上传时间上传
  13. recBack = atk_ms6050_init();
  14. if(recBack != 0){
  15. printf("ATK-MS6050 init failed!\r\n");
  16. return;
  17. }
  18. printf("ATK-MS6050 init\r\n");
  19. recBack = atk_ms6050_dmp_init();
  20. if(recBack != 0){
  21. printf("ATK-MS6050 DMP init failed!\r\n");
  22. return;
  23. }
  24. printf("ATK-MS6050 DMP init!\r\n");
  25. BIT_CLEAR(s_comData.Malfunction, gyroscope);
  26. }
  27. }
  28. /**
  29. * @brief 数据处理任务
  30. * @param None
  31. * @note None
  32. * @retval None
  33. */
  34. void task_handle_data(void){
  35. // 检测是否正在升级固件
  36. if(s_ec800Date.hardwareUpdate == 1){
  37. osDelay(100);
  38. return;
  39. }
  40. // 陀螺仪故障处理 尝试重新连接
  41. // gyroscope_fault_deal();
  42. //
  43. // // 判断车辆是否正在转弯 陀螺仪数据
  44. // if (isTurning()) {
  45. // printf("The vehicle is turning.\r\n");
  46. // } else {
  47. // printf("Vehicle not turning.\r\n");
  48. // }
  49. uint8_t data[8] = {0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55};
  50. HAL_UART_Transmit(&huart1, data, 8, 1000);
  51. osDelay(1000);
  52. }