Merge pull request #77 from Lawlieta/master

修复 check_link 线程重复创建问题,更新 README
This commit is contained in:
朱天龙 (Armink) 2019-11-01 14:28:29 +08:00 committed by GitHub
commit 920beb04b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 16 deletions

View File

@ -2,7 +2,7 @@
## 1. 简介 ##
AT device 软件包是由 RT-Thread AT 组件针对不同 AT 设备的移植文件和示例代码组成,目前支持的 AT 设备有ESP8266、M26、MC20、RW007、MW31、SIM800C 以及 SIM76XX 系列设备等,目前上述设备都完成对 `AT socket` 功能的移植,及设备通过 AT 命令实现标准 socket 编程接口,完成 socket 通讯的功能,具体功能介绍可参考 [《RT-Thread 编程指南》](https://www.rt-thread.org/document/site/programming-manual/at/at/)AT 命令章节 。
AT device 软件包是由 RT-Thread AT 组件针对不同 AT 设备的移植文件和示例代码组成,目前支持的 AT 设备有ESP8266、ESP32、M26、MC20、RW007、MW31、SIM800C 以及 SIM76XX 系列设备等,目前上述设备都完成对 `AT socket` 功能的移植,及设备通过 AT 命令实现标准 socket 编程接口,完成 socket 通讯的功能,具体功能介绍可参考 [《RT-Thread 编程指南》](https://www.rt-thread.org/document/site/programming-manual/at/at/)AT 命令章节 。
### 1.1. 目录结构 ###
@ -44,7 +44,8 @@ AT device 软件包目前已经发布多个版本,各个版本之间选项配
- **V1.4.0**:适用于 RT-Thread 版本小于 V3.1.3或等于 V4.0.0 AT 组件版本等于 V1.2.0
- **V1.5.0**:适用于 RT-Thread 版本小于 V3.1.3 或等于 V4.0.0 AT 组件版本等于 V1.2.0
- **V1.6.0**:适用于 RT-Thread 版本等于 V3.1.3 或等于 V4.0.1 AT 组件版本等于 V1.2.0
- **laster**:只适用于 RT-Thread 版本大于 V4.0.1 或者大于 3.1.3 AT 组件版本大于 V1.2.0
- **V2.0.0/V2.0.1**:适用于 RT-Thread 版本大于 V4.0.1 或者大于 3.1.3 AT 组件版本等于 V1.3.0
- **laster**:只适用于 RT-Thread 版本大于 V4.0.1 或者大于 3.1.3 AT 组件版本等于 V1.3.0
> 上述 版本判断在 menuconfig 中自动完成at_device 软件包选择版本时会根据当前系统环境给出最佳版本支持,这里版本介绍作为运行环境参考。
@ -81,6 +82,7 @@ RT-Thread online packages --->
(uart3) AT client device name
(512) The maximum length of receive line buffer
[ ] Quectel EC20 --->
[ ] Espressif ESP32 --->
[*] Espressif ESP8266 --->
[*] Enable initialize by thread
[*] Enable sample
@ -111,12 +113,6 @@ RT-Thread online packages --->
- **AT client device name**:配置该示例设备使用的串口设备名称;
- **The maximum length of receive line buffer**:配置该示例设备最大一行接收的数据长度;
- **Espressif ESP32**:开启 ESP32 WIFI 模块)设备支持;
- **Enable initialize by thread**:开启使用线程进行设备初始化功能(非阻塞模式初始化);
- **Enable sample**:开启示例代码,该示例代码中有对示例设备的注册;
- **WIFI ssid**:配置该示例设备连接的 WIFI 用户名;
- **WIFI password**:配置该示例设备连接的 WIFI 密码;
- **AT client device name**:配置该示例设备使用的串口设备名称;
- **The maximum length of receive line buffer**:配置该示例设备最大一行接收的数据长度;
- **Realthread RW007**:开启 RW007 WIFI 模块)设备支持;
- **SIMCom SIM800C**:开启 SIM800C 2G 模块)设备支持;
- **SIMCom SIM76XX**:开启 SIM76XX 4G 模块)设备支持;
@ -161,6 +157,11 @@ RT-Thread Components --->
- `laster` 版本支持多个选中多个 AT 设备接入实现 AT Socket 功能,`V1.X.X` 版本只支持单个 AT 设备接入。
- AT device 软件包目前多个版本主要用于适配 AT 组件和系统的改动,推荐使用最新版本 RT-Thread 系统,并在 menuconfig 选项中选择 `latest` 版本;
## 4. 相关文档
- [AT 组件编程指南](https://www.rt-thread.org/document/site/programming-manual/at/at/)
- [应用 AT 组件连接 ESP8266 模块](https://www.rt-thread.org/document/site/application-note/components/at/an0014-at-client/)
## 5. 联系方式
* 维护RT-Thread 开发团队及社区开发者

View File

@ -436,11 +436,14 @@ static int ec20_netdev_check_link_status(struct netdev *netdev)
#define EC20_LINK_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX - 2)
rt_thread_t tid;
char tname[RT_NAME_MAX] = {0};
RT_ASSERT(netdev);
rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name);
/* create ec20 link status polling thread */
tid = rt_thread_create("ec20_link", ec20_check_link_status_entry, (void *)netdev,
tid = rt_thread_create(tname, ec20_check_link_status_entry, (void *)netdev,
EC20_LINK_THREAD_STACK_SIZE, EC20_LINK_THREAD_PRIORITY, EC20_LINK_THREAD_TICK);
if (tid != RT_NULL)
{
@ -886,7 +889,11 @@ static void ec20_init_thread_entry(void *parameter)
{
/* set network interface device status and address information */
ec20_netdev_set_info(device->netdev);
ec20_netdev_check_link_status(device->netdev);
/* check and create link staus sync thread */
if (rt_thread_find(device->netdev->name) == RT_NULL)
{
ec20_netdev_check_link_status(device->netdev);
}
LOG_I("%s device network initialize success.", device->name);
}

View File

@ -294,7 +294,7 @@ static int m26_netdev_check_link_status(struct netdev *netdev)
RT_ASSERT(netdev);
rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name);
rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name);
tid = rt_thread_create(tname, check_link_status_entry, (void *)netdev,
M26_LINK_THREAD_STACK_SIZE, M26_LINK_THREAD_PRIORITY, M26_LINK_THREAD_TICK);
@ -707,7 +707,11 @@ static void m26_init_thread_entry(void *parameter)
if (result == RT_EOK)
{
m26_netdev_set_info(device->netdev);
m26_netdev_check_link_status(device->netdev);
/* check and create link staus sync thread */
if (rt_thread_find(device->netdev->name) == RT_NULL)
{
m26_netdev_check_link_status(device->netdev);
}
LOG_I("%s device network initialize success.", device->name);
}

View File

@ -277,7 +277,7 @@ static int sim76xx_netdev_check_link_status(struct netdev *netdev)
RT_ASSERT(netdev);
rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name);
rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name);
tid = rt_thread_create(tname, check_link_status_entry, (void *)netdev,
SIM76XX_LINK_THREAD_STACK_SIZE, SIM76XX_LINK_THREAD_PRIORITY, SIM76XX_LINK_THREAD_TICK);
@ -704,7 +704,11 @@ static void sim76xx_init_thread_entry(void *parameter)
{
/* set network interface device status and address information */
sim76xx_netdev_set_info(device->netdev);
sim76xx_netdev_check_link_status(device->netdev);
/* check and create link staus sync thread */
if (rt_thread_find(device->netdev->name) == RT_NULL)
{
sim76xx_netdev_check_link_status(device->netdev);
}
LOG_I("%s device network initialize success!", device->name);
}

View File

@ -298,7 +298,7 @@ static int sim800c_netdev_check_link_status(struct netdev *netdev)
RT_ASSERT(netdev);
rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name);
rt_snprintf(tname, RT_NAME_MAX, "%s", netdev->name);
tid = rt_thread_create(tname, check_link_status_entry, (void *) netdev,
SIM800C_LINK_THREAD_STACK_SIZE, SIM800C_LINK_THREAD_PRIORITY, SIM800C_LINK_THREAD_TICK);
@ -796,7 +796,11 @@ static void sim800c_init_thread_entry(void *parameter)
{
/* set network interface device status and address information */
sim800c_netdev_set_info(device->netdev);
sim800c_netdev_check_link_status(device->netdev);
/* check and create link staus sync thread */
if (rt_thread_find(device->netdev->name) == RT_NULL)
{
sim800c_netdev_check_link_status(device->netdev);
}
LOG_I("%s device network initialize success!", device->name);