1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

update espota.py help and add chipd id to hostname from OTA-mDNS-SPIFFS example for better identification

This commit is contained in:
Pascal Gollor 2015-09-28 17:19:42 +02:00
parent ec1c43b5f7
commit 093cb1b081
2 changed files with 8 additions and 4 deletions

View File

@ -17,7 +17,7 @@
* @brief mDNS and OTA Constants * @brief mDNS and OTA Constants
* @{ * @{
*/ */
#define HOSTNAME "ESP8266-ota" ///< Hostename #define HOSTNAME "ESP8266-OTA-" ///< Hostename. The setup function adds the Chip ID at the end.
#define APORT 8266 ///< Port for OTA update #define APORT 8266 ///< Port for OTA update
/// @} /// @}
@ -207,7 +207,11 @@ void setup()
Serial.println(ESP.getChipId(), HEX); Serial.println(ESP.getChipId(), HEX);
// Set Hostname. // Set Hostname.
WiFi.hostname(HOSTNAME); String hostname(HOSTNAME);
hostname += String(ESP.getChipId(), HEX);
WiFi.hostname(hostname);
// Print hostname.
Serial.print("hostname: "); Serial.print("hostname: ");
Serial.println(WiFi.hostname()); Serial.println(WiFi.hostname());
@ -296,7 +300,7 @@ void setup()
} }
// Initialize mDNS service. // Initialize mDNS service.
MDNS.begin(HOSTNAME); MDNS.begin(hostname.c_str());
// ... Add OTA service. // ... Add OTA service.
MDNS.addService("arduino", "tcp", APORT); MDNS.addService("arduino", "tcp", APORT);

View File

@ -123,7 +123,7 @@ def parser():
group.add_option("-p", "--port", group.add_option("-p", "--port",
dest = "esp_port", dest = "esp_port",
type = "int", type = "int",
help = "ESP8266 ota Port.", help = "ESP8266 ota Port. Default 8266",
default = 8266 default = 8266
) )
parser.add_option_group(group) parser.add_option_group(group)