mirror of
https://github.com/esphome/esphome.git
synced 2025-08-06 18:37:47 +00:00
tweak
This commit is contained in:
parent
8563a5785f
commit
727161f1db
@ -47,7 +47,9 @@ void CaptivePortal::start() {
|
||||
this->base_->init();
|
||||
if (!this->initialized_) {
|
||||
this->base_->add_handler(this);
|
||||
#ifdef USE_WEBSERVER_OTA
|
||||
this->base_->add_ota_handler();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_ARDUINO
|
||||
|
@ -256,8 +256,10 @@ void WebServer::setup() {
|
||||
#endif
|
||||
this->base_->add_handler(this);
|
||||
|
||||
#ifdef USE_WEBSERVER_OTA
|
||||
if (this->allow_ota_)
|
||||
this->base_->add_ota_handler();
|
||||
#endif
|
||||
|
||||
// doesn't need defer functionality - if the queue is full, the client JS knows it's alive because it's clearly
|
||||
// getting a lot of events
|
||||
|
@ -186,11 +186,12 @@ void OTARequestHandler::handleRequest(AsyncWebServerRequest *request) {
|
||||
#endif // USE_WEBSERVER_OTA
|
||||
}
|
||||
|
||||
void WebServerBase::add_ota_handler() {
|
||||
#ifdef USE_WEBSERVER_OTA
|
||||
void WebServerBase::add_ota_handler() {
|
||||
this->add_handler(new OTARequestHandler(this)); // NOLINT
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
float WebServerBase::get_setup_priority() const {
|
||||
// Before WiFi (captive portal)
|
||||
return setup_priority::WIFI + 2.0f;
|
||||
|
@ -110,7 +110,9 @@ class WebServerBase : public Component {
|
||||
|
||||
void add_handler(AsyncWebHandler *handler);
|
||||
|
||||
#ifdef USE_WEBSERVER_OTA
|
||||
void add_ota_handler();
|
||||
#endif
|
||||
|
||||
void set_port(uint16_t port) { port_ = port; }
|
||||
uint16_t get_port() const { return port_; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user