Skip to content

Commit

Permalink
repaired wifi receive bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Neyzoter committed Jul 6, 2019
1 parent 7e38db1 commit eef7fea
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 48 deletions.
25 changes: 9 additions & 16 deletions HARDWARE/TIMER/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ void TIM4_IRQHandler(void)
{
/* 系统时钟,计时单位由TIM4设置的中断周期值*/
SYSTEMTIME++;
/* 输出50ms脉冲,用于测量同步时钟精度*/
/*! @note 测试时,需要关闭串口打印功能 @ref PRINT_UART_LOG*/
#if IO_SHINE_IN_TIMER
if(MS_TIME%50==0){//50ms输出一个脉冲
PAout(9) = ~PAout(9);
PAout(10) = ~PAout(10);
}
#endif
}
TIM_ClearITPendingBit(TIM4,TIM_IT_Update); //清除中断标志位
}
Expand Down Expand Up @@ -130,17 +138,10 @@ void TIM3_IRQHandler(void)
//!adc数值缓存
u8 * adcTamp;
MS_TIME ++ ;
// PagingTime++;
//!溢出中断
if(TIM_GetITStatus(TIM3,TIM_IT_Update)==SET)
{
// if(PagingTime > 11000){
// Wifi_Send_EN = 0;
// CAN_Get_EN = 0;
// ADC_Get_EN = 0;
// queue_clear((Queue *)&adc_queue);
// queue_clear((Queue *)&can_queue);
// }

/**
* 在系统初始化后才能运行的程序
*/
Expand Down Expand Up @@ -219,14 +220,6 @@ void TIM3_IRQHandler(void)
dealCmdMsg(&CMD_RX_BUF);
}

/* 输出50ms脉冲,用于测量同步时钟精度*/
/*! @note 测试时,需要关闭串口打印功能 @ref PRINT_UART_LOG*/
#if IO_SHINE_IN_TIMER
if(MS_TIME%50==0){//50ms输出一个脉冲
PAout(9) = ~PAout(9);
PAout(10) = ~PAout(10);
}
#endif
}

TIM_ClearITPendingBit(TIM3,TIM_IT_Update);
Expand Down
6 changes: 2 additions & 4 deletions HARDWARE/WIFI/userwifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
u32 YYMMDD =0; //年月日
u8 Time_Sync_Flag = 0; //最近时钟是否同步
volatile u8 Wifi_Send_EN = 0; //数据采集和发送使能,是CAN和ADC采集的总开关
u8 CAN_Get_EN = CAN1_ENABLE_BIT_SLC|CAN2_ENABLE_BIT_SLC; //CAN数据发送使能(第0位使能can1,第1位使能can2),默认开启(必须满足Wifi_Send_EN=1,才能采集)
u8 ADC_Get_EN = 1; //ADC数据采集使能,默认开启(必须满足Wifi_Send_EN=1,才能采集)
u8 CAN_Get_EN = 0; //CAN数据发送使能(第0位使能can1,第1位使能can2),默认开启(必须满足Wifi_Send_EN=1,才能采集)
u8 ADC_Get_EN = 0; //ADC数据采集使能,默认开启(必须满足Wifi_Send_EN=1,才能采集)
Queue adc_queue; //ADC数据存储
Queue can_queue; //can数据存储
u8 localDestIp_txrx[4] = {255,255,255,255};
Expand Down Expand Up @@ -324,7 +324,6 @@ u8 wifi_send_package(void)
* @param 接收到的命令首地址
* @retval 是否需要返回信息给上位机(NOT_NEED_RETURN_INFO 或 NEED_RETURN_INFO)
*/
u32 PagingTime = 0;
u8 order_anay(u8 arr[],u8 beenCallByMain)
{
switch(arr[0])
Expand Down Expand Up @@ -407,7 +406,6 @@ u8 order_anay(u8 arr[],u8 beenCallByMain)
}
break;
case PAGING://寻呼信号
PagingTime=0;
break;
default:
return NOT_NEED_RETURN_INFO;
Expand Down
2 changes: 0 additions & 2 deletions HARDWARE/WIFI/userwifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ typedef enum{

//!系统时钟
extern u32 SYSTEMTIME;
//!距离上次寻呼的时间
extern u32 PagingTime;
//!年月日
extern u32 YYMMDD;

Expand Down
26 changes: 2 additions & 24 deletions HARDWARE/WIFI/wificonf.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,7 @@ void WIFI_NVIC_Config(void)
NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
/**
* @brief 设置WIFI的中断NVIC
* @param None
* @retval None
*/
void WIFI_NVIC_Disable(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel=WIFI_INTR_EXTI_CH;
NVIC_InitStructure.NVIC_IRQChannelCmd=DISABLE;
NVIC_Init(&NVIC_InitStructure);
}

/**
* @brief WIFI模组的引脚配置
* @param None
Expand Down Expand Up @@ -138,18 +127,7 @@ void WIFI_EXTI_Conf(void)
EXTI_Type.EXTI_LineCmd=ENABLE;
EXTI_Init(&EXTI_Type);
}
/**
* @brief 设置MCU接收WiFi信号的外部中断配置
* @param None
* @retval None
*/
void WIFI_EXTI_Disable(void)
{
EXTI_InitTypeDef EXTI_Type;
EXTI_Type.EXTI_Line=WIFI_INTR_EXTI_LINE;
EXTI_Type.EXTI_LineCmd=DISABLE;
EXTI_Init(&EXTI_Type);
}

/**
* @brief SPI的收发
* @param None
Expand Down
4 changes: 2 additions & 2 deletions USER/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <stdlib.h>
#include <stdio.h>

u8 RSI_JOIN_SSID[RSI_JOIN_SSID_MAX_LENGTH] = "418_Lab_5G"; /*!< WIFI名称>*/
u8 RSI_PSK[RSI_PSK_MAX_LENGTH] = "518518518"; /*!< WIFI密码>*/
u8 RSI_JOIN_SSID[RSI_JOIN_SSID_MAX_LENGTH] = "mywifi5G"; /*!< WIFI名称>*/
u8 RSI_PSK[RSI_PSK_MAX_LENGTH] = "1234567890"; /*!< WIFI密码>*/
u8 nodeId = 4; /*!< 节点ID,0-255>*/
u32 RSI_WIFI_OPER_MODE = RSI_WIFI_CLIENT_MODE_VAL; /*!< CLIENT或者AP模式>*/
u8 RSI_IP_CFG_MODE = RSI_DHCP_IP_MODE; /*!< @ RSI_DHCP_IP_MODE or RSI_STATIC_IP_MODE >*/
Expand Down

0 comments on commit eef7fea

Please sign in to comment.