Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
ad4cf146
Commit
ad4cf146
authored
Feb 03, 2021
by
me-no-dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework setHostname for WiFi STA
Fixes:
https://github.com/espressif/arduino-esp32/issues/2537
parent
5de03a39
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
1 deletion
+4
-1
libraries/WiFi/src/WiFiGeneric.cpp
libraries/WiFi/src/WiFiGeneric.cpp
+1
-0
libraries/WiFi/src/WiFiSTA.cpp
libraries/WiFi/src/WiFiSTA.cpp
+2
-1
libraries/WiFi/src/WiFiSTA.h
libraries/WiFi/src/WiFiSTA.h
+1
-0
No files found.
libraries/WiFi/src/WiFiGeneric.cpp
View file @
ad4cf146
...
...
@@ -379,6 +379,7 @@ esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event, wif
}
else
if
(
event
->
event_id
==
SYSTEM_EVENT_STA_START
)
{
WiFiSTAClass
::
_setStatus
(
WL_DISCONNECTED
);
setStatusBits
(
STA_STARTED_BIT
);
tcpip_adapter_set_hostname
(
TCPIP_ADAPTER_IF_STA
,
WiFiSTAClass
::
_hostname
.
c_str
());
}
else
if
(
event
->
event_id
==
SYSTEM_EVENT_STA_STOP
)
{
WiFiSTAClass
::
_setStatus
(
WL_NO_SHIELD
);
clearStatusBits
(
STA_STARTED_BIT
|
STA_CONNECTED_BIT
|
STA_HAS_IP_BIT
|
STA_HAS_IP6_BIT
);
...
...
libraries/WiFi/src/WiFiSTA.cpp
View file @
ad4cf146
...
...
@@ -71,6 +71,7 @@ static bool sta_config_equal(const wifi_config_t& lhs, const wifi_config_t& rhs)
bool
WiFiSTAClass
::
_autoReconnect
=
true
;
bool
WiFiSTAClass
::
_useStaticIp
=
false
;
String
WiFiSTAClass
::
_hostname
=
"esp32-arduino"
;
static
wl_status_t
_sta_status
=
WL_NO_SHIELD
;
static
EventGroupHandle_t
_sta_status_group
=
NULL
;
...
...
@@ -283,7 +284,6 @@ bool WiFiSTAClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subne
}
tcpip_adapter_ip_info_t
info
;
log_d
(
"STA IP uint32_t: %u.%u.%u.%u
\n
"
,
local_ip
[
0
],
local_ip
[
1
],
local_ip
[
2
],
local_ip
[
3
]);
if
(
local_ip
!=
(
uint32_t
)
0x00000000
&&
local_ip
!=
INADDR_NONE
){
info
.
ip
.
addr
=
static_cast
<
uint32_t
>
(
local_ip
);
...
...
@@ -637,6 +637,7 @@ const char * WiFiSTAClass::getHostname()
*/
bool
WiFiSTAClass
::
setHostname
(
const
char
*
hostname
)
{
_hostname
=
hostname
;
if
(
WiFiGenericClass
::
getMode
()
==
WIFI_MODE_NULL
){
return
false
;
}
...
...
libraries/WiFi/src/WiFiSTA.h
View file @
ad4cf146
...
...
@@ -86,6 +86,7 @@ public:
int8_t
RSSI
();
static
void
_setStatus
(
wl_status_t
status
);
static
String
_hostname
;
protected:
static
bool
_useStaticIp
;
static
bool
_autoReconnect
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment