Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
QWFLS
arduino-esp32
提交
d8aa61fa
A
arduino-esp32
项目概览
QWFLS
/
arduino-esp32
与 Fork 源项目一致
从无法访问的项目Fork
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
arduino-esp32
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d8aa61fa
编写于
11月 13, 2016
作者:
M
me-no-dev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize some error messages
上级
7e0811ec
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
18 deletion
+14
-18
libraries/WiFi/src/WiFiClient.cpp
libraries/WiFi/src/WiFiClient.cpp
+8
-8
libraries/WiFi/src/WiFiGeneric.cpp
libraries/WiFi/src/WiFiGeneric.cpp
+6
-10
未找到文件。
libraries/WiFi/src/WiFiClient.cpp
浏览文件 @
d8aa61fa
...
...
@@ -59,7 +59,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port)
{
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sockfd
<
0
)
{
log_e
(
"
error
: %d"
,
errno
);
log_e
(
"
socket
: %d"
,
errno
);
return
0
;
}
uint32_t
ip_addr
=
ip
;
...
...
@@ -70,7 +70,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port)
serveraddr
.
sin_port
=
htons
(
port
);
int
res
=
lwip_connect_r
(
sockfd
,
(
struct
sockaddr
*
)
&
serveraddr
,
sizeof
(
serveraddr
));
if
(
res
<
0
)
{
log_e
(
"
erro
r: %d"
,
errno
);
log_e
(
"
lwip_connect_
r: %d"
,
errno
);
close
(
sockfd
);
sockfd
=
-
1
;
return
0
;
...
...
@@ -94,7 +94,7 @@ int WiFiClient::setSocketOption(int option, char* value, size_t len)
{
int
res
=
setsockopt
(
sockfd
,
SOL_SOCKET
,
option
,
value
,
len
);
if
(
res
<
0
)
{
log_e
(
"
error:
%d"
,
errno
);
log_e
(
"%d"
,
errno
);
}
return
res
;
}
...
...
@@ -114,7 +114,7 @@ int WiFiClient::setOption(int option, int *value)
{
int
res
=
setsockopt
(
sockfd
,
IPPROTO_TCP
,
option
,
(
char
*
)
value
,
sizeof
(
int
));
if
(
res
<
0
)
{
log_e
(
"
error:
%d"
,
errno
);
log_e
(
"%d"
,
errno
);
}
return
res
;
}
...
...
@@ -124,7 +124,7 @@ int WiFiClient::getOption(int option, int *value)
size_t
size
=
sizeof
(
int
);
int
res
=
getsockopt
(
sockfd
,
IPPROTO_TCP
,
option
,
(
char
*
)
value
,
&
size
);
if
(
res
<
0
)
{
log_e
(
"
error:
%d"
,
errno
);
log_e
(
"%d"
,
errno
);
}
return
res
;
}
...
...
@@ -164,7 +164,7 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size)
}
int
res
=
send
(
sockfd
,
(
void
*
)
buf
,
size
,
MSG_DONTWAIT
);
if
(
res
<
0
)
{
log_e
(
"
error:
%d"
,
errno
);
log_e
(
"%d"
,
errno
);
_connected
=
false
;
sockfd
=
-
1
;
res
=
0
;
...
...
@@ -179,7 +179,7 @@ int WiFiClient::read(uint8_t *buf, size_t size)
}
int
res
=
recv
(
sockfd
,
buf
,
size
,
MSG_DONTWAIT
);
if
(
res
<
0
&&
errno
!=
EWOULDBLOCK
)
{
log_e
(
"
error:
%d"
,
errno
);
log_e
(
"%d"
,
errno
);
_connected
=
false
;
sockfd
=
-
1
;
}
...
...
@@ -194,7 +194,7 @@ int WiFiClient::available()
int
count
;
int
res
=
ioctl
(
sockfd
,
FIONREAD
,
&
count
);
if
(
res
<
0
)
{
log_e
(
"
error:
%d"
,
errno
);
log_e
(
"%d"
,
errno
);
_connected
=
false
;
sockfd
=
-
1
;
return
0
;
...
...
libraries/WiFi/src/WiFiGeneric.cpp
浏览文件 @
d8aa61fa
...
...
@@ -32,11 +32,11 @@ extern "C" {
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <esp_err.h>
#include <esp_wifi.h>
#include <esp_event_loop.h>
#include <lwip/ip_addr.h>
#include "lwip/ip_addr.h"
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/dns.h"
...
...
@@ -44,9 +44,6 @@ extern "C" {
#include "esp32-hal-log.h"
}
//#include "WiFiClient.h"
//#include "WiFiUdp.h"
#undef min
#undef max
#include <vector>
...
...
@@ -107,7 +104,7 @@ void WiFiGenericClass::removeEvent(WiFiEventCb cbEvent, system_event_id_t event)
*/
esp_err_t
WiFiGenericClass
::
_eventCallback
(
void
*
arg
,
system_event_t
*
event
)
{
log_d
(
"
wifi evt:
%d"
,
event
->
event_id
);
log_d
(
"%d"
,
event
->
event_id
);
if
(
event
->
event_id
==
SYSTEM_EVENT_SCAN_DONE
)
{
WiFiScanClass
::
_scanDone
();
...
...
@@ -122,7 +119,6 @@ esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event)
}
else
{
WiFiSTAClass
::
_setStatus
(
WL_DISCONNECTED
);
}
log_d
(
"wifi reason: %d"
,
reason
);
}
else
if
(
event
->
event_id
==
SYSTEM_EVENT_STA_START
)
{
WiFiSTAClass
::
_setStatus
(
WL_DISCONNECTED
);
}
else
if
(
event
->
event_id
==
SYSTEM_EVENT_STA_STOP
)
{
...
...
@@ -303,13 +299,13 @@ void startWiFi()
err
=
esp_wifi_start
();
if
(
err
!=
ESP_OK
)
{
log_e
(
"esp_wifi_start
fail %d
\n
"
,
err
);
log_e
(
"esp_wifi_start
: %d
"
,
err
);
return
;
}
err
=
esp_wifi_get_mode
(
&
mode
);
if
(
err
!=
ESP_OK
)
{
log_e
(
"esp_wifi_get_mode
fail %d
\n
"
,
err
);
log_e
(
"esp_wifi_get_mode
: %d
"
,
err
);
return
;
}
...
...
@@ -317,7 +313,7 @@ void startWiFi()
if
((
mode
==
WIFI_MODE_STA
||
mode
==
WIFI_MODE_APSTA
)
&&
auto_connect
)
{
err
=
esp_wifi_connect
();
if
(
err
!=
ESP_OK
)
{
log_e
(
"esp_wifi_connect
fail %d
\n
"
,
err
);
log_e
(
"esp_wifi_connect
: %d
"
,
err
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录