diff --git a/ETH/UdpServer/User/interface.h b/ETH/UdpServer/User/interface.h index 7a8b0cf..7af833d 100644 --- a/ETH/UdpServer/User/interface.h +++ b/ETH/UdpServer/User/interface.h @@ -256,13 +256,20 @@ typedef struct _StrRequestMessage // uint8_t data[4]; // }YisDateFrame; +typedef enum{ + init = 0, + uart, + ethernet, +}rtcm_type; typedef struct { uint8_t dma_buffer[2][RX_BUFFER_LEN]; // 双缓冲 - volatile uint8_t active_buf; // 当前活跃缓冲区索引 - volatile uint16_t buf_len; // 当前活跃缓冲区索引 + volatile uint8_t active_buf; // 当前活跃缓冲区索引 + volatile uint16_t buf_len; // 当前活跃缓冲区索引 + volatile rtcm_type type; // 串口或者以太网 + volatile uint8_t eth_cnt; // 当前活跃缓冲区索引 } rtcmBuffer; diff --git a/ETH/UdpServer/User/interface_etherent.c b/ETH/UdpServer/User/interface_etherent.c index 7445ae7..fc694c0 100644 --- a/ETH/UdpServer/User/interface_etherent.c +++ b/ETH/UdpServer/User/interface_etherent.c @@ -28,7 +28,10 @@ u16 Desport = 7900; u8 pc_ipAddr[4] = { 192, 168, 17, 2 }; //IP address -u8 tcp_socket[WCHNET_NUM_TCP]; //Save the currently connected socket +u8 remote_base_ip[4] = { 192, 168, 10, 8 }; //Զ̻վIP address +u16 remote_port = 1008; //Զ̻վ˿ + +u8 tcp_socket[WCHNET_NUM_TCP]; //Save the currently connected socket SystemDataRecord g_systemDataRecord = {0,0,0,0}; @@ -50,6 +53,8 @@ uint8_t portableOcuOnline = 0; uint8_t remoteOcuOnline = 0; Timer ethernet_timer_interface; + +Timer ethernet_timer_interface1; /********************************************************************* * @fn mStopIfError * @@ -277,6 +282,33 @@ void WCHNET_UdpServerRecv2(struct _SCOK_INF *socinf, u32 ipaddr, u16 port, u8 *b } } +/********************************************************************* + * @fn WCHNET_CreateTcpSocket + * + * @brief Create TCP Socket + * + * @return none + */ +void WCHNET_CreateTcpSocket(void) +{ + u8 i; + SOCK_INF TmpSocketInf; + + memset((void *) &TmpSocketInf, 0, sizeof(SOCK_INF)); + memcpy((void *) TmpSocketInf.IPAddr, remote_base_ip, 4); + TmpSocketInf.DesPort = remote_port; + TmpSocketInf.SourPort = 1008; + TmpSocketInf.ProtoType = PROTO_TYPE_TCP; + TmpSocketInf.RecvBufLen = RECE_BUF_LEN; + i = WCHNET_SocketCreat(&SocketId3, &TmpSocketInf); + printf("SocketId %d\r\n", SocketId3); + mStopIfError(i); + i = WCHNET_SocketConnect(SocketId3); //make a TCP connection + mStopIfError(i); +} + + + /********************************************************************* * @fn WCHNET_CreateUdpSocket * @@ -286,7 +318,7 @@ void WCHNET_UdpServerRecv2(struct _SCOK_INF *socinf, u32 ipaddr, u16 port, u8 *b */ void WCHNET_CreateUdpSocket(void) { - u8 i; +// u8 i; SOCK_INF TmpSocketInf; // memset((void *) &TmpSocketInf, 0, sizeof(SOCK_INF)); @@ -310,14 +342,15 @@ void WCHNET_CreateUdpSocket(void) #endif memset(tcp_socket, 0xff, WCHNET_NUM_TCP); - memset((void *) &TmpSocketInf, 0, sizeof(SOCK_INF)); - TmpSocketInf.SourPort = srcport; - TmpSocketInf.ProtoType = PROTO_TYPE_TCP; - i = WCHNET_SocketCreat(&SocketId, &TmpSocketInf); - printf("SocketIdForListen %d\r\n", SocketId); - mStopIfError(i); - i = WCHNET_SocketListen(SocketId); //listen for connections - mStopIfError(i); + WCHNET_CreateTcpSocket(); + // memset((void *) &TmpSocketInf, 0, sizeof(SOCK_INF)); + // TmpSocketInf.SourPort = srcport; + // TmpSocketInf.ProtoType = PROTO_TYPE_TCP; + // i = WCHNET_SocketCreat(&SocketId, &TmpSocketInf); + // printf("SocketIdForListen %d\r\n", SocketId); + // mStopIfError(i); + // i = WCHNET_SocketListen(SocketId); //listen for connections + // mStopIfError(i); // memset((void *)&TmpSocketInf, 0, sizeof(SOCK_INF)); @@ -336,21 +369,77 @@ void WCHNET_CreateUdpSocket(void) TmpSocketInf.RecvStartPoint = (u32) SocketRecvBuf2; TmpSocketInf.RecvBufLen = RECE_BUF_LEN; TmpSocketInf.AppCallBack = WCHNET_UdpServerRecv2; - i = WCHNET_SocketCreat(&SocketId3, &TmpSocketInf); + WCHNET_SocketCreat(&SocketId3, &TmpSocketInf); printf("WCHNET_SocketCreat %d\r\n", SocketId3); + + // mStopIfError(i); - // memset((void *) &TmpSocketInf, 0, sizeof(SOCK_INF)); - // memcpy((void *) TmpSocketInf.IPAddr, DESIP, 4); - // TmpSocketInf.DesPort = desport; - // TmpSocketInf.SourPort = srcport++; - // TmpSocketInf.ProtoType = PROTO_TYPE_TCP; - // TmpSocketInf.RecvBufLen = RECE_BUF_LEN; - // i = WCHNET_SocketCreat(&SocketId4, &TmpSocketInf); - // printf("SocketId4 %d\r\n", SocketId4); - // mStopIfError(i); - // i = WCHNET_SocketConnect(SocketId4); //make a TCP connection - // mStopIfError(i); +} + +/********************************************************************* + * @fn WCHNET_DataLoopback + * + * @brief Data loopback function. + * + * @param id - socket id. + * + * @return none + */ +void WCHNET_DataLoopback(u8 id) +{ +#if 1 + u8 i; + u32 len; + u32 endAddr = SocketInf[id].RecvStartPoint + SocketInf[id].RecvBufLen; //Receive buffer end address + + if ((SocketInf[id].RecvReadPoint + SocketInf[id].RecvRemLen) > endAddr) + { //Calculate the length of the received data + len = endAddr - SocketInf[id].RecvReadPoint; + } + else + { + len = SocketInf[id].RecvRemLen; + } + + + if(remote_port == SocketInf[id].DesPort)//ݣԴ˿ȷΪ̫RTCM + { + memcpy(&RTCM_Buffer1.dma_buffer[RTCM_Buffer1.active_buf][0],(u8 *) SocketInf[id].RecvReadPoint,len); + RTCM_Buffer1.type = ethernet; + RTCM_Buffer1.buf_len = (uint16_t)len; + RTCM_Buffer1.active_buf ^= 1; + RTCM_Buffer1.eth_cnt ++;//ۼж + publishMessage(&RTCM_Buffer1, 1); + } + + // printf("Դ˿: %u, Ŀ˿: %u\n", + // SocketInf[id].SourPort, SocketInf[id].DesPort); + + + // i = WCHNET_SocketSend(id, (u8 *) SocketInf[id].RecvReadPoint, &len); //send data + + if (i == WCHNET_ERR_SUCCESS) { + WCHNET_SocketRecv(id, NULL, &len); //Clear sent data + } +#else + u32 len, totallen; + u8 *p = MyBuf, TransCnt = 255; + + len = WCHNET_SocketRecvLen(id, NULL); //query length + printf("Receive Len = %d\r\n", len); + totallen = len; + WCHNET_SocketRecv(id, MyBuf, &len); //Read the data of the receive buffer into MyBuf + while(1){ + len = totallen; + WCHNET_SocketSend(id, p, &len); //Send the data + totallen -= len; //Subtract the sent length from the total length + p += len; //offset buffer pointer + if( !--TransCnt ) break; //Timeout exit + if(totallen) continue; //If the data is not sent, continue to send + break; //After sending, exit + } +#endif } /********************************************************************* @@ -368,6 +457,7 @@ void WCHNET_HandleSockInt(u8 socketid, u8 intstat) u8 i; if (intstat & SINT_STAT_RECV) //receive data { + WCHNET_DataLoopback(socketid); } if (intstat & SINT_STAT_CONNECT) //connect successfully { @@ -403,6 +493,7 @@ void WCHNET_HandleSockInt(u8 socketid, u8 intstat) } } printf("TCP Timeout\r\n"); + WCHNET_CreateTcpSocket(); } } @@ -498,7 +589,7 @@ uint8_t CalculateChecksum(const uint8_t* data, size_t len) static void ethernetInterfaceTimerProcess(void *signal_id) { static u_int32_t navigation_output_len = 0; - static u_int32_t navigation_output_len1 = 0; +// static u_int32_t navigation_output_len1 = 0; //---------------------------------------------------------------------- if (signal_id == &navigation_output1) { @@ -536,21 +627,21 @@ static void ethernetInterfaceTimerProcess(void *signal_id) navigation_outputC1.bit_data.crc1 = CalculateChecksum(&navigation_outputC1.arr[0],sizeof(UnInfNavigationOutputC)-1); - for(uint8_t i = 0; i < WCHNET_NUM_TCP; i++) - { - if(tcp_socket[i] != 0xFF) - { - if(0 == navigation_output_len1) - { - navigation_output_len1 = sizeof(navigation_outputC1); - } + // for(uint8_t i = 0; i < WCHNET_NUM_TCP; i++) + // { + // if(tcp_socket[i] != 0xFF) + // { + // if(0 == navigation_output_len1) + // { + // navigation_output_len1 = sizeof(navigation_outputC1); + // } - i = WCHNET_SocketSend(tcp_socket[i], (uint8_t *)&navigation_outputC1, &navigation_output_len1); //send data - if (i == WCHNET_ERR_SUCCESS) { - WCHNET_SocketRecv(tcp_socket[i], NULL, &navigation_output_len1); //Clear sent data - } - } - } + // i = WCHNET_SocketSend(tcp_socket[i], (uint8_t *)&navigation_outputC1, &navigation_output_len1); //send data + // if (i == WCHNET_ERR_SUCCESS) { + // WCHNET_SocketRecv(tcp_socket[i], NULL, &navigation_output_len1); //Clear sent data + // } + // } + // } } else if (signal_id == &navigation_output2) { @@ -593,7 +684,7 @@ static void ethernetInterfaceTimerProcess(void *signal_id) } UdpSendToData(SocketId2, (uint8_t *)&navigation_output2, &navigation_output_len, &str_RequestMessage.ip_adesser[0],str_RequestMessage.port);// } - else + else { } @@ -614,6 +705,22 @@ void ethInterruptProcess(void *signal_id) timerStart(ðernet_timer_interface, 1,1); //1msһ } +void ethernetFaultProcess(void *signal_id)//̫RTCMжϡ +{ + static uint8_t eth_cnt_last = 0; + if( (RTCM_Buffer1.eth_cnt == eth_cnt_last) && (ethernet == RTCM_Buffer1.type) )//һ5sǶϿˡ + { + RTCM_Buffer1.type = init; + } + else + { + eth_cnt_last = RTCM_Buffer1.eth_cnt; + } + timerStart(ðernet_timer_interface1, 8000,1); //8sһ +} + + + void ethernetInterfaceInit(void) { @@ -622,7 +729,14 @@ void ethernetInterfaceInit(void) subscribe(&navigation_output1, ethernetInterfaceTimerProcess); subscribe(&navigation_output2, ethernetInterfaceTimerProcess); subscribe(ðernet_timer_interface, ethInterruptProcess); + subscribe(ðernet_timer_interface1, ethernetFaultProcess); //1msһ + timerStart(ðernet_timer_interface, 1,1); //1msһ + + timerStart(ðernet_timer_interface1, 5000,1); //5sһ + + + printf( "ethernetInterface: initial OK %d\n",getCurrentTime()); } diff --git a/ETH/UdpServer/User/interface_uart.c b/ETH/UdpServer/User/interface_uart.c index 94d8a27..44010d8 100644 --- a/ETH/UdpServer/User/interface_uart.c +++ b/ETH/UdpServer/User/interface_uart.c @@ -1,7 +1,7 @@ /* * eth_drive.c * - * Created on: 2023��1��5�� + * Created on: 2023??1??5?? * Author: Administrator */ @@ -18,7 +18,7 @@ static RingBuffer nmea_rx_buf; #define DMA_BUF_SIZE 1400 uint8_t dma_rx_buffer[DMA_BUF_SIZE] __attribute__((aligned(4))); -//__attribute__((aligned(4))) uint8_t dma_buffer[2048]; // GCC�﷨ +//__attribute__((aligned(4))) uint8_t dma_buffer[2048]; // GCC?? //void USART2_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast"))); @@ -48,7 +48,7 @@ void USART3_IRQHandler(void) { imu_buffer1.buf_len = IMU_LEN - DMA_GetCurrDataCounter(IMU_RX_CH); - if( (imu_buffer1.dma_buffer[imu_buffer1.active_buf][0] == IMU_IIM46234_HEADER1) && //�������������� + if( (imu_buffer1.dma_buffer[imu_buffer1.active_buf][0] == IMU_IIM46234_HEADER1) && //?????????????? (imu_buffer1.dma_buffer[imu_buffer1.active_buf][1] == IMU_IIM46234_HEADER2) ) { imu_buffer1.type = IIM46234; @@ -80,19 +80,24 @@ void UART4_IRQHandler(void) enter_critical_section(); if(USART_GetITStatus(UART4, USART_IT_IDLE) != RESET) { - RTCM_Buffer1.buf_len = RX_BUFFER_LEN - DMA_GetCurrDataCounter(RTCM_RX_CH); - RTCM_Buffer1.active_buf ^= 1; + if(ethernet != RTCM_Buffer1.type)//ֻҪ̫״̬ + { + RTCM_Buffer1.type = uart;//ڽģʽ + RTCM_Buffer1.buf_len = RX_BUFFER_LEN - DMA_GetCurrDataCounter(RTCM_RX_CH); + RTCM_Buffer1.active_buf ^= 1; - DMA_Cmd(RTCM_RX_CH, DISABLE); - DMA_SetCurrDataCounter(RTCM_RX_CH, RX_BUFFER_LEN); - // Switch buffer - RTCM_RX_CH->MADDR = (uint32_t)(uintptr_t)&(RTCM_Buffer1.dma_buffer[RTCM_Buffer1.active_buf][0]); - DMA_Cmd(RTCM_RX_CH, ENABLE); - printf("rtcm receive\n"); + DMA_Cmd(RTCM_RX_CH, DISABLE); + DMA_SetCurrDataCounter(RTCM_RX_CH, RX_BUFFER_LEN); + // Switch buffer + RTCM_RX_CH->MADDR = (uint32_t)(uintptr_t)&(RTCM_Buffer1.dma_buffer[RTCM_Buffer1.active_buf][0]); + DMA_Cmd(RTCM_RX_CH, ENABLE); + printf("rtcm receive\n"); + + USART_ReceiveData(UART4); // clear IDLE flag + publishMessage(&RTCM_Buffer1, 1); + } - USART_ReceiveData(UART4); // clear IDLE flag - publishMessage(&RTCM_Buffer1, 1); } exit_critical_section(0); } @@ -103,9 +108,8 @@ void UART8_IRQHandler(void) enter_critical_section(); if(USART_GetITStatus(UART8, USART_IT_RXNE) != RESET) { - uint8_t UART_temp = 0; - UART_temp = USART_ReceiveData(UART8); -// printf("USART8:%d\n", UART_temp); // ���� + USART_ReceiveData(UART8); +// printf("USART8:%d\n", UART_temp); // ???? } exit_critical_section(0); } @@ -118,7 +122,7 @@ void UART6_IRQHandler(void) enter_critical_section(); if(USART_GetITStatus(UART6, USART_IT_RXNE) != RESET) { - char ch = USART_ReceiveData(UART6); + USART_ReceiveData(UART6); } exit_critical_section(0); } @@ -131,7 +135,7 @@ void UART7_IRQHandler(void) DMA_Cmd(UM982_RX_CH, DISABLE); uint16_t received_len = DMA_BUF_SIZE - DMA_GetCurrDataCounter(UM982_RX_CH); - // 3. �����ݿ��������λ����� + // 3. ??????????????????? for(uint16_t i = 0; i < received_len; i++) { uint16_t next_head = (nmea_rx_buf.head + 1) % RING_BUF_SIZE; @@ -166,7 +170,7 @@ void DMA1_Channel3_IRQHandler(void) enter_critical_section(); imu_buffer1.buf_len = RX_BUFFER_LEN; - DMA_ClearITPendingBit(DMA1_IT_TC3);//�����ж� + DMA_ClearITPendingBit(DMA1_IT_TC3);//?????? exit_critical_section(0); } @@ -184,7 +188,7 @@ void DMA2_Channel3_IRQHandler(void) enter_critical_section(); RTCM_Buffer1.buf_len = RX_BUFFER_LEN; - DMA_ClearITPendingBit(DMA2_IT_TC3);//�����ж� + DMA_ClearITPendingBit(DMA2_IT_TC3);//?????? exit_critical_section(0); } @@ -198,7 +202,7 @@ void DMA2_Channel3_IRQHandler(void) void DMA2_Channel9_IRQHandler(void) { enter_critical_section(); - DMA_ClearITPendingBit(DMA2_IT_TC9);//�����ж� + DMA_ClearITPendingBit(DMA2_IT_TC9);//?????? exit_critical_section(0); } @@ -242,7 +246,7 @@ void dmaInit(void) DMA_Cmd(RTCM_RX_CH, ENABLE); USART_DMACmd(RTCM_UART, USART_DMAReq_Rx, ENABLE); -//IMU DMA���� +//IMU DMA???? DMA_DeInit(IMU_RX_CH); DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; @@ -270,7 +274,7 @@ void dmaInit(void) USART_DMACmd(IMU_UART, USART_DMAReq_Rx, ENABLE); -//982 DMA���� +//982 DMA???? DMA_DeInit(UM982_RX_CH); DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; @@ -363,7 +367,7 @@ void initUart(void) NVIC_Init(&NVIC_InitStructure); USART_Cmd(UART4, ENABLE); -/* UART6 TX-->C.0 RX-->C.1 */ //�ӵ�982��com1 +/* UART6 TX-->C.0 RX-->C.1 */ //???982??com1 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; @@ -389,7 +393,7 @@ void initUart(void) NVIC_Init(&NVIC_InitStructure); USART_Cmd(UART6, ENABLE); -/* UART7 TX-->C.2 RX-->C.3 *///�ӵ�982��com2 +/* UART7 TX-->C.2 RX-->C.3 *///???982??com2 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; @@ -443,7 +447,7 @@ void initUart(void) -void uartSendto(USART_TypeDef *USARTx, uint8_t * ucData, uint16_t len)//����2���ͺ��� +void uartSendto(USART_TypeDef *USARTx, uint8_t * ucData, uint16_t len)//????2??????? { for(uint16_t i = 0; i= 20) @@ -555,82 +558,86 @@ void ProcessNMEAFrames(void *signal_id) while(nmea_rx_buf.tail != nmea_rx_buf.head && !frame_complete) - { // �������ǿ���δ���һ֡���� + { // ???????????????????? uint8_t ch = nmea_rx_buf.buffer[nmea_rx_buf.tail]; nmea_rx_buf.tail = (nmea_rx_buf.tail + 1) % RING_BUF_SIZE; if(nmea_rx_buf.overflow) { nmea_rx_buf.tail = nmea_rx_buf.head; - // 3. ���������־ + // 3. ?????????? nmea_rx_buf.overflow = 0; - // 4. ��������ָ����̣����ط����� + // 4. ???????????????????????? printf("Overflow recovery\n"); } - // ֡ͷ��� + // ????? if(ch == '$') { if(parse_idx > 0 && parsing_buf[parse_idx-1] == '\n') { - if (nmea_validate_checksum((char *)parsing_buf)) //У����� + if (nmea_validate_checksum((char *)parsing_buf)) //????? { memcpy(&nema_output1.buffer[0],parsing_buf,parse_idx); publishMessage(&nema_output1, 1); - frame_complete = true; // ���֡������� + frame_complete = true; // ??????????? } else { printf("nmea crc error"); - frame_complete = true; // ���֡������� + frame_complete = true; // ??????????? } } parse_idx = 0; } - // �洢���� + // ????? if(parse_idx < RING_BUF_SIZE-1 && !frame_complete) { parsing_buf[parse_idx++] = ch; - // ֡β��� + // ???? if(parse_idx >= 2 && parsing_buf[parse_idx-2] == '\r' && parsing_buf[parse_idx-1] == '\n') { - if (nmea_validate_checksum((char *)parsing_buf)) //У����� + if (nmea_validate_checksum((char *)parsing_buf)) //????? { memcpy(&nema_output1.buffer[0],parsing_buf,parse_idx); publishMessage(&nema_output1, 1); - frame_complete = true; // ���֡������� + frame_complete = true; // ??????????? } else { printf("nmea buf error"); - frame_complete = true; // ���֡������� + frame_complete = true; // ??????????? } parse_idx = 0; } } else if(!frame_complete) { - parse_idx = 0; // ��ֹ��� + parse_idx = 0; // ?????? } } - timerStart(&nmea_timer, 10, 1); // 100ms���ٴδ��� + timerStart(&nmea_timer, 10, 1); // 100ms??????? } void navigationRs232Process(void *signal_id) { uartSendto(UART8, (uint8_t *)&navigation_rs232_output, sizeof(navigation_rs232_output)); + +// uint32_t debubg_len = sizeof(navigation_rs232_output); +// uint8_t debug_ip[4] = {192,168,17,8}; +// UdpSendToData(SocketId2, (uint8_t *)&navigation_rs232_output, &debubg_len,debug_ip,8011);// } -// APPģ��ij�ʼ�� +// APP???????? void interfaceUartInit(void) { subscribe(&set_output_data, setDataProcess); diff --git a/ETH/UdpServer/User/net_config.h b/ETH/UdpServer/User/net_config.h index a9b729c..75b5a46 100644 --- a/ETH/UdpServer/User/net_config.h +++ b/ETH/UdpServer/User/net_config.h @@ -26,7 +26,7 @@ extern "C" { #define WCHNET_NUM_TCP 1 /* Number of TCP connections */ -#define WCHNET_NUM_TCP_LISTEN 1 /* Number of TCP listening */ +#define WCHNET_NUM_TCP_LISTEN 0 /* Number of TCP listening */ /* The number of sockets, the maximum is 31 */ #define WCHNET_MAX_SOCKET_NUM (WCHNET_NUM_IPRAW+WCHNET_NUM_UDP+WCHNET_NUM_TCP+WCHNET_NUM_TCP_LISTEN) diff --git a/ETH/UdpServer/app/app_data_processing.c b/ETH/UdpServer/app/app_data_processing.c index 2c36e41..cf26a60 100644 --- a/ETH/UdpServer/app/app_data_processing.c +++ b/ETH/UdpServer/app/app_data_processing.c @@ -378,12 +378,6 @@ void rs232Process(void) navigation_rs232_output.bit_data.checksum = calculate_checksum(&navigation_rs232_output.arr[0],57); publishMessage(&navigation_rs232_output, 1); -// uint32_t debubg_len = 58; -// uint8_t debug_ip[4] = {192,168,17,77}; -// UdpSendToData(SocketId2, (uint8_t *)&navigation_output2, &debubg_len,debug_ip,8011);// - - - // timerStart(&rs232_output_timer, 20,1);//10ms } @@ -479,29 +473,29 @@ void iim6234Init(void *signal_id) void nmeaPrintf(void *signal_id) { - printf("[THS] Heading:%.1f Mode:%c\n", - ths_data1.heading, ths_data1.mode); - printf("[VTG] Course:%.1f Speed:%.1fkm/h\n", - vtg_data1.course_true, vtg_data1.speed_kmh); + // printf("[THS] Heading:%.1f Mode:%c\n", + // ths_data1.heading, ths_data1.mode); + // printf("[VTG] Course:%.1f Speed:%.1fkm/h\n", + // vtg_data1.course_true, vtg_data1.speed_kmh); - printf("[GGA] Time:%.2f Lat:%.5f%c Lon:%.5f%c Alt:%.2f rtk_state:%d satellite:%d hdop:%2f\n", - gga_data1.utc_time, - gga_data1.latitude, gga_data1.lat_dir, - gga_data1.longitude, gga_data1.lon_dir, - gga_data1.altitude, // ߶ȵλΪM() - gga_data1.fix_quality, - gga_data1.satellites, - gga_data1.hdop - ); + // printf("[GGA] Time:%.2f Lat:%.5f%c Lon:%.5f%c Alt:%.2f rtk_state:%d satellite:%d hdop:%2f\n", + // gga_data1.utc_time, + // gga_data1.latitude, gga_data1.lat_dir, + // gga_data1.longitude, gga_data1.lon_dir, + // gga_data1.altitude, // ߶ȵλΪM() + // gga_data1.fix_quality, + // gga_data1.satellites, + // gga_data1.hdop + // ); - printf("Ԫ: (%.6f, %.6f, %.6f, %.6f)\n", - yis321_data.bit_data.q0*0.000001, yis321_data.bit_data.q1*0.000001, yis321_data.bit_data.q2*0.000001, (int32_t)yis321_data.bit_data.q3*0.000001); + // printf("Ԫ: (%.6f, %.6f, %.6f, %.6f)\n", + // yis321_data.bit_data.q0*0.000001, yis321_data.bit_data.q1*0.000001, yis321_data.bit_data.q2*0.000001, (int32_t)yis321_data.bit_data.q3*0.000001); - printf("ŷ: (%.6f, %.6f, %.6f)\n", - yis321_data.bit_data.pitch*0.000001, yis321_data.bit_data.roll*0.000001, yis321_data.bit_data.yaw*0.000001); + // printf("ŷ: (%.6f, %.6f, %.6f)\n", + // yis321_data.bit_data.pitch*0.000001, yis321_data.bit_data.roll*0.000001, yis321_data.bit_data.yaw*0.000001); - printf("AccX:%f,AccY:%f,AccZ:%f,",Acc[0],Acc[1],Acc[2]); - printf("GyroX:%f,GyroY:%f,GyroZ:%f\r\n",Gyro[0],Gyro[1],Gyro[2]);//ʹôڴӡٶȣٶ + // printf("AccX:%f,AccY:%f,AccZ:%f,",Acc[0],Acc[1],Acc[2]); + // printf("GyroX:%f,GyroY:%f,GyroZ:%f\r\n",Gyro[0],Gyro[1],Gyro[2]);//ʹôڴӡٶȣٶ timerStart(&data_processing_timer, 1000,1);//100ms } @@ -517,6 +511,8 @@ void dataProcessingAppInit(void) timerInit(&rm3100_timer); timerInit(&data_processing_timer); timerInit(&rs232_output_timer); + + RTCM_Buffer1.type = init; rm3100Init();//ʼRM3100 // ĶʱźţڽGNGGA diff --git a/ETH/UdpServer/app/app_test.c b/ETH/UdpServer/app/app_test.c index 5aaf61f..c736be3 100644 --- a/ETH/UdpServer/app/app_test.c +++ b/ETH/UdpServer/app/app_test.c @@ -18,7 +18,7 @@ Timer test_timer; void testTimerProcess(void *signal_id) { (void)signal_id; // 标记变量为已使用,避免编译器警告 - static uint32_t start_time = 0; +// static uint32_t start_time = 0; // short hx,hy,hz=0; printf("testAPP\n"); @@ -50,7 +50,7 @@ void testTimerProcess(void *signal_id) // UdpSendToData(SocketId,arrtest4,ÐUDPTxLen,IP1,8011);//测试 - start_time = getCurrentTime(); +// start_time = getCurrentTime(); // 再次启动定时器,实现周期定时 timerStart(&test_timer, 1000,1);