Rename WEBSERVER_PORT define to USE_WEBSERVER_PORT (#3102)

This commit is contained in:
Oxan van Leeuwen 2022-01-24 00:34:38 +01:00 committed by GitHub
parent 2a84db7f85
commit c2ee0f0864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

View File

@ -805,7 +805,7 @@ DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) {
resp.project_version = ESPHOME_PROJECT_VERSION;
#endif
#ifdef USE_WEBSERVER
resp.webserver_port = WEBSERVER_PORT;
resp.webserver_port = USE_WEBSERVER_PORT;
#endif
return resp;
}

View File

@ -128,7 +128,7 @@ void ESP32ImprovComponent::loop() {
std::vector<std::string> urls = {ESPHOME_MY_LINK};
#ifdef USE_WEBSERVER
auto ip = wifi::global_wifi_component->wifi_sta_ip();
std::string webserver_url = "http://" + ip.str() + ":" + to_string(WEBSERVER_PORT);
std::string webserver_url = "http://" + ip.str() + ":" + to_string(USE_WEBSERVER_PORT);
urls.push_back(webserver_url);
#endif
std::vector<uint8_t> data = improv::build_rpc_response(improv::WIFI_SETTINGS, urls);

View File

@ -95,7 +95,7 @@ std::vector<uint8_t> ImprovSerialComponent::build_rpc_settings_response_(improv:
std::vector<std::string> urls;
#ifdef USE_WEBSERVER
auto ip = wifi::global_wifi_component->wifi_sta_ip();
std::string webserver_url = "http://" + ip.str() + ":" + to_string(WEBSERVER_PORT);
std::string webserver_url = "http://" + ip.str() + ":" + to_string(USE_WEBSERVER_PORT);
urls.push_back(webserver_url);
#endif
std::vector<uint8_t> data = improv::build_rpc_response(command, urls, false);

View File

@ -16,8 +16,8 @@ namespace mdns {
static const char *const TAG = "mdns";
#ifndef WEBSERVER_PORT
#define WEBSERVER_PORT 80 // NOLINT
#ifndef USE_WEBSERVER_PORT
#define USE_WEBSERVER_PORT 80 // NOLINT
#endif
void MDNSComponent::compile_records_() {
@ -63,7 +63,7 @@ void MDNSComponent::compile_records_() {
MDNSService service{};
service.service_type = "_prometheus-http";
service.proto = "_tcp";
service.port = WEBSERVER_PORT;
service.port = USE_WEBSERVER_PORT;
this->services_.push_back(service);
}
#endif
@ -74,7 +74,7 @@ void MDNSComponent::compile_records_() {
MDNSService service{};
service.service_type = "_http";
service.proto = "_tcp";
service.port = WEBSERVER_PORT;
service.port = USE_WEBSERVER_PORT;
service.txt_records.push_back({"version", ESPHOME_VERSION});
this->services_.push_back(service);
}

View File

@ -66,8 +66,8 @@ async def to_code(config):
cg.add_define("USE_WEBSERVER")
cg.add(paren.set_port(config[CONF_PORT]))
cg.add_define("WEBSERVER_PORT", config[CONF_PORT])
cg.add_define("USE_WEBSERVER")
cg.add_define("USE_WEBSERVER_PORT", config[CONF_PORT])
cg.add(var.set_css_url(config[CONF_CSS_URL]))
cg.add(var.set_js_url(config[CONF_JS_URL]))
cg.add(var.set_allow_ota(config[CONF_OTA]))

View File

@ -47,8 +47,8 @@
#define USE_MQTT
#define USE_PROMETHEUS
#define USE_WEBSERVER
#define USE_WEBSERVER_PORT 80 // NOLINT
#define USE_WIFI_WPA2_EAP
#define WEBSERVER_PORT 80 // NOLINT
#endif
// ESP32-specific feature flags