File tree 2 files changed +8
-4
lines changed
hardware/esp8266com/esp8266
libraries/ESP8266mDNS/examples/OTA-mDNS-SPIFFS
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 17
17
* @brief mDNS and OTA Constants
18
18
* @{
19
19
*/
20
- #define HOSTNAME " ESP8266-ota " // /< Hostename
20
+ #define HOSTNAME " ESP8266-OTA- " // /< Hostename. The setup function adds the Chip ID at the end.
21
21
#define APORT 8266 // /< Port for OTA update
22
22
// / @}
23
23
@@ -207,7 +207,11 @@ void setup()
207
207
Serial.println (ESP.getChipId (), HEX);
208
208
209
209
// Set Hostname.
210
- WiFi.hostname (HOSTNAME);
210
+ String hostname (HOSTNAME);
211
+ hostname += String (ESP.getChipId (), HEX);
212
+ WiFi.hostname (hostname);
213
+
214
+ // Print hostname.
211
215
Serial.print (" hostname: " );
212
216
Serial.println (WiFi.hostname ());
213
217
@@ -296,7 +300,7 @@ void setup()
296
300
}
297
301
298
302
// Initialize mDNS service.
299
- MDNS.begin (HOSTNAME );
303
+ MDNS.begin (hostname. c_str () );
300
304
301
305
// ... Add OTA service.
302
306
MDNS.addService (" arduino" , " tcp" , APORT);
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ def parser():
123
123
group .add_option ("-p" , "--port" ,
124
124
dest = "esp_port" ,
125
125
type = "int" ,
126
- help = "ESP8266 ota Port." ,
126
+ help = "ESP8266 ota Port. Default 8266 " ,
127
127
default = 8266
128
128
)
129
129
parser .add_option_group (group )
You can’t perform that action at this time.
0 commit comments