Skip to content

Commit

Permalink
beautifully change : main.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Neyzoter committed Apr 25, 2019
1 parent e1f5089 commit d529aad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
11 changes: 1 addition & 10 deletions HARDWARE/WIFI/userwifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ void receive_udp_package()
}

break;
//!无线更新RS9113固件
// case RSI_FWUP_RSP:
// rsi_wireless_fwupgrade();
// break;
default:
break;

Expand Down Expand Up @@ -242,26 +238,21 @@ u8 wifi_send_package()
delay_ms(WIFI_MODUEL_WAIT_MSTIME);
temp = DATA_AUTO_CHECK_EN;
DATA_AUTO_CHECK_EN = 0;
/* CAN数据发送到局域网*/
//! 是否打印出要发出去的CAN数据
#if CHECK_CAN_STATUS_PRINTF
// for(int i =0 ;i < Can_Length+PACKAGE_HEAD_FRAME_LENGTH;i++){
// printf("%x ",can_queue.arr[(Can_Head+i)%QUEUE_SIZE]);
// }
// printf("\r\n");
//校验时间最低位是否正确
printf("%x ?= %x\r\n",can_queue.arr[(Can_Head+4)%QUEUE_SIZE],can_queue.arr[(Can_Head+15)%QUEUE_SIZE]);
if(can_queue.arr[(Can_Head+15)%QUEUE_SIZE] != can_queue.arr[(Can_Head+4)%QUEUE_SIZE]){
printf("Time Check Error\r\n");
}
//校验数据长度

u32 count = can_queue.arr[(Can_Head+8)%QUEUE_SIZE] + 256 * can_queue.arr[(Can_Head+9)%QUEUE_SIZE] + 256 * 256 * can_queue.arr[(Can_Head+10)%QUEUE_SIZE];
printf("count : %d ?= Can_Length : %d\r\n",count,Can_Length);
if(count != Can_Length){
printf("Len Check Error\r\n");
}
#endif
/* CAN数据发送到局域网*/
rsi_send_ludp_data(localSocketDescriptor_txrx, &can_queue.arr[Can_Head],Can_Length+PACKAGE_HEAD_FRAME_LENGTH, RSI_PROTOCOL_UDP_V4, (uint8 *)localDestIp_txrx, localDestSocket_txrx, &bytes_sent);
DATA_AUTO_CHECK_EN = temp;
}else if(queue_length(&can_queue) > 0){ /* CAN队列中数据存储时间过长,以us为单位,就发出来*/
Expand Down
3 changes: 3 additions & 0 deletions HARDWARE/WIFI/userwifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ extern unsigned short localSocketDescriptor_txrx;
//!是否在中断中自动check数据
extern u8 DATA_AUTO_CHECK_EN;

//!字节数据发送个数
extern u32 bytes_sent;

void receive_udp_package(void);
void wifi_send_package_test(void);
u8 OpenLudpSocket(u8* destIp,unsigned short destSocket,unsigned short moduleSocket,unsigned short * socketDescriptor);
Expand Down
10 changes: 5 additions & 5 deletions USER/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
#include "rsi_app.h"
#include "crc.h"

u8 IO_input[3];
extern u32 bytes_sent;
#define CAN_INIT_REBOOT 0 /*< 是否开机启动can,进行测试>*/

void testAdc(void);
u8 can_send_package(void);
void Initialization (void);

/**
Expand Down Expand Up @@ -79,10 +77,12 @@ void Initialization (void)
/*ADC相关引脚初始化*/
ADC_CTRL_Conf();

// /* CAN测试*/
/* CAN测试*/
#if CAN_INIT_REBOOT
u32 filter[7] = {0x1800f001,0x1800f002,0x1800f003,0x1800f004,0x1800f005,0x1800f006,0x1800f007};
CAN1_Mode_Init(CAN_SJW_1tq,CAN_BS1_6tq,CAN_BS2_7tq,12,CAN_Mode_Normal,(u32 *)filter,7);
// CAN2_Mode_Init(CAN_SJW_1tq,CAN_BS1_6tq,CAN_BS2_7tq,6,CAN_Mode_Normal,(u32 *)filter,7);
CAN2_Mode_Init(CAN_SJW_1tq,CAN_BS1_6tq,CAN_BS2_7tq,6,CAN_Mode_Normal,(u32 *)filter,7);
#endif
/*系统时间100us中断*/
TIM4_Int_Init(TIM4_ARR,TIM4_PSC);
#if PRINT_UART_LOG
Expand Down

0 comments on commit d529aad

Please sign in to comment.