Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
d1507ae6
Commit
d1507ae6
authored
Feb 21, 2022
by
Eric Duminil
Browse files
Setting Hostname (more) reliably
parent
98427bcf
Pipeline
#5888
passed with stage
in 2 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/src/lib/IotWebConf/src/IotWebConf.cpp
View file @
d1507ae6
...
...
@@ -93,13 +93,7 @@ bool IotWebConf::init()
this
->
_apTimeoutMs
=
atoi
(
this
->
_apTimeoutStr
)
*
1000
;
// -- Setup mdns
#ifdef ESP8266
WiFi
.
hostname
(
this
->
_thingName
);
#elif defined(ESP32)
WiFi
.
setHostname
(
this
->
_thingName
);
#endif
#ifdef IOTWEBCONF_CONFIG_USE_MDNS
//TODO: What is _thingName set to at this point??
MDNS
.
begin
(
this
->
_thingName
);
MDNS
.
addService
(
"http"
,
"tcp"
,
IOTWEBCONF_CONFIG_USE_MDNS
);
#endif
...
...
@@ -729,6 +723,9 @@ void IotWebConf::stateChanged(NetworkState oldState, NetworkState newState)
#endif
this
->
_wifiConnectionStart
=
millis
();
WiFi
.
mode
(
WIFI_STA
);
// Hostname must be set right before WiFi.begin in order to work reliably,
// and will be set only once WiFi.begin has been called.
WiFi
.
setHostname
(
this
->
_thingName
);
this
->
_wifiConnectionHandler
(
this
->
_wifiAuthInfo
.
ssid
,
this
->
_wifiAuthInfo
.
password
);
break
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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